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
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
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 T.
http://dathompson.blogspot.com
Thank you David,
It seems that’s the way to go.
Roland
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’)
nice post i also looking for this solution
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs