Page 1 of 1

Need help with watermarking in Imagemagick

Posted: 2014-03-18T08:25:25-07:00
by tcarp
Hi everyone,

I am brand new to this forum, so thanks in advance for and help I really appreciate it!

So anyways I have about 1000 images in a folder called "Photos Compressed". The folders are numbers as follows "001, 002, etc." Each folder has 8-10 images in it. These image are 2400w x 1600h in dimension. I have a watermark that I created in Photoshop which I then saved as a PNG that is the same size (2400 x 1600).

I need to add the watermark to all of the photos using ImageMagick. I wanted them to go into a new folder called "Photos Watermarked". These new images need to maintain the folder structure of the old folder "Photos Compressed" with all subfolders etc. These new photos also will be scaled down to 640h x 480w.

I basically want the .png watermark to overlay each new image in the new folder keeping the folder structure.

How would I go about this? I am unfamiliar with ImageMagick and I have access to both a Mac and a PC. I tried using Photoshop's image processor but it takes forever and it is not working properly. Any help would be greatly, greatly appreciated.

Thanks!
Tom

Re: Need help watermarking images in Image Magick!

Posted: 2014-03-18T08:46:51-07:00
by snibgo
Do you know how to write scripts on either machine? Pick the one you are most familiar with.

Perhaps you have the 640x480 dimensions the wrong way round.

I would start by working out the command that works on a single image. It might be something like:

Code: Select all

convert in.tiff watermark.png -composite -resize 640x480 out.tiff
When that does what you want, you could put that in a two nested loops: the outer one loops through directories, the inner one loops through images in the directory. Instead of the inner one, you could use mogrify. (I wouldn't, simply because I rarely do this kind of work, and don't mind the performance penalty of running "convert" on every image.)

Re: Need help watermarking images in Image Magick!

Posted: 2014-03-18T08:51:55-07:00
by Bonzo
Instead of the inner one, you could use mogrify.
I think mogrify reads all the images in before the conversion starts which could result in a memory problem? I suppose you could send the images to mogrify in batch's but I would use convert as well.

Re: Need help watermarking images in Image Magick!

Posted: 2014-03-18T08:57:46-07:00
by snibgo
Bonzo wrote:I think mogrify reads all the images in before the conversion starts which could result in a memory problem?
Could be. If there are only 10 images per directory, at 8 bytes/pixel, this is 307MB, which probably isn't a problem.

Re: Need help watermarking images in Image Magick!

Posted: 2014-03-18T09:25:33-07:00
by tcarp
thanks guys! I am more familiar with Windows command line. I used FFmpeg before to convert videos.