Page 1 of 1

Composite images

Posted: 2009-12-14T16:26:34-07:00
by enkei666
I'm new to ImageMagick and have a little problem.
I have several images of the same size (e.g. 24 images of 1280x960).
Each image contains only a ribbon of 40 pixels with useful data. The first from y=0-40, the second from y=40-80 and so on.
All pixels not on this ribbon are black.

What I want to do: Combining the several images to one image, which contains all ribbons.
My first try:
=> I loop over all images and use the combine console application to combine two images at a time:
=> composite -compose add img1.png img2.png result.png

This process takes a lot of time (compositing the complete image instead of just the ribbon) and I think one can do combination much faster.
It would be very nice if someone can help me with this.
Thanks in advance!

Best,
enkei666

Re: Composite images

Posted: 2009-12-14T16:47:52-07:00
by fmw42
In command line, the fastest way would be to crop each image and append them.

convert image1[1280x40+0+0] image2[1280x40+0+40] image3[1280x40+0+80] ... -append combinedimage

alternately

convert image1 image2 ... image24 -fill none -opaque black -background black -flatten combinedimage

the latter makes all black into transparent and then flattens all images onto a black background, which should then be completely filled by the image strips

see
http://www.imagemagick.org/script/comma ... php#append
http://www.imagemagick.org/Usage/layers/#append
http://www.imagemagick.org/Usage/layers/#flatten

general reading and examples at:
http://www.imagemagick.org/Usage/

Re: Composite images

Posted: 2009-12-15T04:47:24-07:00
by enkei666
Thank you very much!
Your first approach is extremly fast and works perfectly for my purpose :)

Best,
enkei666