How to batch composite same image as bg to all images

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
toxicv
Posts: 1
Joined: 2011-05-26T04:20:49-07:00
Authentication code: 8675308

How to batch composite same image as bg to all images

Post by toxicv »

Hi
I thought this would be a fairly straighforward command but cannot figure out how to do it.

I have a directory full of transparent PNG files which I would like to replace the transparent background with the SAME image to ALL.

The background image I would like to use is called bg.jpg and the images I would like to add this to the background to are all randomly named *.PNG files.

The background JPEG is 800x677 pixels and the PNG files need to be resized to fit that resolution too. Ideally at the same command but obviously if I need to run two batches, one to resize the PNGs first, then one to do the composition then that's fine. But would prefer to do the whole resize and composition in one run if possible.

Is there a simple mogrify option to batch run a whole folder?

Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to batch composite same image as bg to all images

Post by fmw42 »

mogrify only works with one image at a time. you cannot do composition with mogrify, to my knowledge. looks like you need to write a script to loop over all your images and do the composition and other things. But also see http://www.imagemagick.org/Usage/basics/#mogrify_not
Post Reply