Apply tiled watermark to multiple images in a single process
Matt Hurne <matt <at> thehurnes.com>
2012-10-11 17:13:03 GMT
I've scoured the web for a solution to the following problem, without success:
I would like to execute a single gm process to apply a tiled watermark
image to multiple images (which are the same image at various scales).
Currently, I execute one process per image, using commands like:
gm composite -tile watermark.png ORIG_MAX_400.jpg WM_MAX_400.jpg
gm composite -tile watermark.png ORIG_MAX_200.jpg WM_MAX_200.jpg
I've tried a plethora of commands in an attempt to achieve the same
result as the above commands in a single command, including variations
of gm mogrify, gm convert, and gm composite. The closest I've come was
when using the following command:
gm mogrify -output-directory out -create-directories -draw "image over
0,0 0,0 watermark.png" ORIG_MAX_*.jpg
In the case of that command, I end up with a watermarked version of
each of the input images, but the watermark isn't tiled.
Is there a way to achieve this? I considered issuing one gm composite
to watermark the original unscaled image and then a second command to
end up with all the scaled versions (that's how I get the
non-watermarked scaled images), but that will result in the watermark
itself being scaled in addition to the image, which isn't what I want.
My ultimate goal is to execute as few processes as possible; if it can
be done with more than one process but less than one per scaled image,
that will probably be sufficient for my needs.