-
Notifications
You must be signed in to change notification settings - Fork 77
Watermarking
Dave Harris edited this page Oct 29, 2024
·
6 revisions
A watermark can be applied to an image during processing.
From the composite documentation:
Take the first image 'destination' and overlay the second 'source' image according to the current -compose setting. The location of the 'source' or 'overlay' image is controlled according to -gravity, and -geometry settings.
ImageProcessing::MiniMagick
provides a #composite
wrapper method for defining composition:
watermark # can be String, Pathname, File, or Tempfile
ImageProcessing::MiniMagick
.source(original)
.composite(watermark, # Set the watermark as the overlay image
mode: "over", # Apply the watermark 'over' the source (default)
gravity: "south-east", # Apply the watermark in the bottom right corner
offset: [10, 10], # Apply the watermark 10 pixels up and left from ':gravity' setting
)
.call # Apply operation
ImageProcessing::Vips
provides a #composite
wrapper method around the vips_composite()
libvips function:
watermark # can be String, Pathname, File, Tempfile, or Vips::Image
ImageProcessing::Vips
.source(original)
.composite(watermark, # Set the watermark as the overlay image
mode: "over", # Apply the watermark 'over' the source (default)
gravity: "south-east", # Apply the watermark in the bottom right corner
offset: [10, 10], # Apply the watermark 10 pixels up and left from ':gravity' setting
)
.call # Apply operation