I need to add watermarks to images, cmd ImageMagick command
convert image.png watermark.png -composite target.jpg
or
composite -watermark 30% -tile watermark.png image.png target.jpg
How can I do this operation with ActiveStorage::Variant?
Try this:
def medium_img_watermark
if self.img_first.attached?
self.img_first.variant(resize: '1200', quality: 75, density: 96,
combine_options: {
gravity: 'center',
draw: 'image Over 0,0 0,0 "public/logo_white.png"'
}).processed
end
end
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