Forum: Ruby on Rails Watermarks?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and 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,


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

Here's a link:


David Andrew T.
Roland (Guest)
on 2006-03-12 01:05
Thank you David,

It seems that's the way to go.

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 ='watermark.gif').first
wr = watermark.rows
wc = watermark.columns

img ='original.gif').first
ir = img.rows
ic = img.columns

img.store_pixels(ir-wr, 0, wr, wc ,watermark.get_pixels(0,0, wr, wc))
This topic is locked and can not be replied to.