Page 1 of 1

image stack

Posted: 2013-03-29T10:46:57-07:00
by GreenKoopa
Many operators take two images. For example:

Code: Select all

convert gray_image.jpg lut.png -clut out.jpg
Is there a general rule for what happens if there are more images in the stack? Some operators (eg -composite) can use a third image as a mask. Other operators (eg -append) operate on the first two to create one, then repeat until the entire image stack is used.

What I want to do is use one second image to operate on a list of first images. So

Code: Select all

convert gray_image_0.jpg gray_image_1.jpg gray_image_2.jpg lut.png -clut out.jpg
would produce 3 files (out-#.jpg). -clut appears to operate on the first two and simply delete additional ones. Can -clut be used the way I want, or better, is there more general syntax for this?


I'm currently using ImageMagick 6.8.0-6 2012-11-20 Q16

Re: image stack

Posted: 2013-03-29T12:03:11-07:00
by fmw42
I do not think you can do that with -clut in IM 6. You will need to write a script to loop over the input images and clut them with the lut image.

It may be possible in IM 7 and Anthony is making IM 7 more scriptable. Anthony will have to comment further.

Re: image stack

Posted: 2013-04-02T23:28:02-07:00
by anthony
I have not changed -clut, at least no yet.

Not certain what it does either. But I would agree that it should remove the last image as the CLUT image, and then loop over all the other images.


Pulling my soap box out....

I would like -composite to do this too. but currently you have to insert a 'null:' separate image and use -layers composite to do that.

The problem is there is a 'three image' form of -composite, though really it is equivalent to using the third image to temporarily set a write mask (after negating the thrid image) on the first image.

See the last example in...
Write Masks - Protecting Pixels from Change
http://www.imagemagick.org/Usage/masking/#write_mask
Which shows the 'equivalent' three image composition using a normal two image composition.


WARNING: -mask sets a 'protect these pixels' mask. -composite however uses a 'write these pixels' mask (the negated form)
Basically the difference is what a 'white' is supposed to represent in the masking image.