Batch overlay multiple images over single source image, convert and save with sequential numbers

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
beedawg1985
Posts: 3
Joined: 2017-12-01T03:55:25-07:00
Authentication code: 1152

Batch overlay multiple images over single source image, convert and save with sequential numbers

Post by beedawg1985 » 2017-12-01T04:04:30-07:00

I have a folder of .ppm images ( ./overlays )
I have a single .ppm image (./ortho_photo.ppm) that I would like to blend each overlay image over using a photoshop style 'overlay' blend mode
I would like to save the blended images as jpegs with a sequential numbering system (./proc/processed_001.jpg ...002.jpg etc.)

Have tried various methods without much luck:
e.g
convert ./overlays/*.ppm -set filename: '%t' null: ./ortho_photo.ppm -compose overlay ./dest/%[filename:].jpg

Gives me a few images but not looking right and with weird names. Any help would be well appreciated!

snibgo
Posts: 9596
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Batch overlay multiple images over single source image, convert and save with sequential numbers

Post by snibgo » 2017-12-01T04:42:08-07:00

wrote:I have a single .ppm image (./ortho_photo.ppm) that I would like to blend each overlay image over using a photoshop style 'overlay' blend mode.
I'm not exactly sure what you want, but perhaps it is "hardlight", which is the same as "overlay" but swapping the two images.

For the output filename "./proc/processed_001.jpg ...002.jpg", you can simple use "./proc/processed_%03d.jpg" as the output filename.
snibgo's IM pages: im.snibgo.com

beedawg1985
Posts: 3
Joined: 2017-12-01T03:55:25-07:00
Authentication code: 1152

Re: Batch overlay multiple images over single source image, convert and save with sequential numbers

Post by beedawg1985 » 2017-12-01T06:10:41-07:00

Hey, yes, hardlight blending of the images would be fine.

I'm now trying:
convert *.ppm /Volumes/Data/RTI/sandbox/ortho/Waun-Mawn16-ortho_modified.comp.ppm -compose hardlight processed_%03d.jpg

Weirdly even though there are only 5 files in the current directory this command produces 10 images, none of which seem to have Waun-Mawn16-ortho_modified.comp.ppm blended into them.

snibgo
Posts: 9596
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Batch overlay multiple images over single source image, convert and save with sequential numbers

Post by snibgo » 2017-12-01T06:19:56-07:00

"-compose" is a setting. It does nothing to images, but effects "-layers composite" (and other operations). So insert "-layers composite" before the output name. See http://www.imagemagick.org/script/comma ... php#layers

You correctly had "null:" after the first list of input images, and you need this for "-layers composite".

Code: Select all

convert *.ppm null: /Volumes/Data/RTI/sandbox/ortho/Waun-Mawn16-ortho_modified.comp.ppm -compose hardlight -layers composite processed_%03d.jpg
snibgo's IM pages: im.snibgo.com

beedawg1985
Posts: 3
Joined: 2017-12-01T03:55:25-07:00
Authentication code: 1152

Re: Batch overlay multiple images over single source image, convert and save with sequential numbers

Post by beedawg1985 » 2017-12-01T06:34:56-07:00

That's brilliant - thank you.

Post Reply