Im trying to add a watermark to processed images with below code I got from several resources:
def watermark
manipulate! do |img|
logo = Magick::Image.read("#{Rails.root}/assets/images/watermarks/watermark.png").first
img = img.composite(logo, Magick::SouthEastGravity, Magick::OverCompositeOp)
end
end
Only problem is, you guess it, does not work. I get no errors in log/console whatsoever
This is my method inside my uploaded and called like:
def function
version :thumb do
process :resize_to_fill => [96, 96]
process :watermark
end
end
Any thoughts on getting some logs on why this doesn't work? I have the Rmagick gems and Imagemagick installed on my system (OSX) And resizing of images does work correct.
I just do it this way and it works very fine:
# Process files as they are uploaded:
process :resize_to_fill => [850, 315]
process :convert => 'png'
process :watermark
def watermark
manipulate! do |img|
logo = Magick::Image.read("#{Rails.root}/app/assets/images/watermark.png").first
img = img.composite(logo, Magick::NorthWestGravity, 15, 0, Magick::OverCompositeOp)
end
end
B.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With