Forum: Ruby on Rails Watermarks?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Roland (Guest)
on 2006-03-12 00:28
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
David Andrew T. (Guest)
on 2006-03-12 00:36
(Received via mailing list)
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
Roland (Guest)
on 2006-03-12 01:05
Thank you David,

It seems that's the way to go.

Roland
Roland (Guest)
on 2006-03-12 02:14
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')
This topic is locked and can not be replied to.