I have desperately searched the web about how to apply watermarks to images in RoR Has anyone been able to apply watermarks to pictures using ruby? Any tips are very much welcomed, Thanks, Roland -- Posted via http://www.ruby-forum.com/.
Haven''t tried it myself, but you might try the "stegano" effect with rmagic: Here''s a link: http://redux.imagemagick.org/RMagick/doc/image3.html#stegano Dave -- ~~~~~~~~~~~~~~~~~~~ David Andrew Thompson http://dathompson.blogspot.com On 3/11/06, Roland <roland_mai@hotmail.com> wrote:> I have desperately searched the web about how to apply watermarks to > images in RoR > > Has anyone been able to apply watermarks to pictures using ruby? > > Any tips are very much welcomed, > > Thanks, > > Roland > > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Thank you David, It seems that''s the way to go. Roland -- Posted via http://www.ruby-forum.com/.
I think I figured it out here is the code for anyone that is interested.
The suggestion of David, stegano, allows for some secret marking of the
images that can not be seen when looking at the image throug a viewer
such gthumb.
A better way is to simply replace the pixels as shown below.
require ''RMagick''
watermark = Magick::Image.read(''watermark.gif'').first
wr = watermark.rows
wc = watermark.columns
img = Magick::Image.read(''original.gif'').first
ir = img.rows
ic = img.columns
img.store_pixels(ir-wr, 0, wr, wc ,watermark.get_pixels(0,0, wr, wc))
img.write(''fina.gif'')
--
Posted via http://www.ruby-forum.com/.