Layering Multiple Images into a Single Image

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
cforster
Posts: 2
Joined: 2011-11-01T14:07:23-07:00
Authentication code: 8675308

Layering Multiple Images into a Single Image

Post by cforster »

I've poked around the forums and tried to find an answer to what I hope is a simple task---but I'm such a rank amateur, that I suspect an imagemagick guru could answer this question quickly. Apologies if there is a glaringly obvious answer to this question I've simply failed to understand.

I have a few directories with PNGs in them (between 30 and 100 files); these PNGs are page images from old periodicals. I would like to essentially layer all of the pages on top of one another into a single image, the size of a single page, with each page averaged. My hope is to get some insight from the result of how a particular issue (or run of issues) were laid out; by comparing one composite image (made up of all the issues from one year) to another composite image (made up of images from another year) I hope to see, at a glance, how page design/layout changed. (Did the gutter between columns of text, for example, get narrower as paper got more scarce? Did page margins? Line height?)

Any thoughts on the best approach to this task? Is ImageMagick the best tool to use?

(I am running ImageMagick 6.6.2 on Ubuntu Linux)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Layering Multiple Images into a Single Image

Post by anthony »

Average your images!

Code: Select all

convert  page*.png  -evaluate-sequence mean  average_page.png
See Layering Images, Evaluate-Sequence - Mutli-Image Merging Methods, Average
http://www.imagemagick.org/Usage/layers ... e-sequence

You could use multiply too. though at this time only a -flatten with a Multiply compose method would work in the expected way due to normalization issues (to be fixed). For example...

Code: Select all

   convert ... -background white -compose multiply -layers flatten ...
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
cforster
Posts: 2
Joined: 2011-11-01T14:07:23-07:00
Authentication code: 8675308

Re: Layering Multiple Images into a Single Image

Post by cforster »

Thanks; it worked excellently. I had tried that command before but got errors because the images were slightly different sizes. With your recommendation I simply scaled them all to the same size and was able to do exactly what I'd wanted. Wonderful. Many thanks!
Post Reply