image stack

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
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

image stack

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: image stack

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: image stack

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply