Page 1 of 1

enhancement suggestion for -clut

Posted: 2008-07-12T17:01:54-07:00
by fmw42
I have notice that -clut will not process a multi-frame gif (without separating the frames). I was wondering, whether that could be changed in the near future, if not too difficult. For example:

create gradient:
convert -size 100x100 gradient: -rotate 90 grad100.gif

make into 3 frame gif:
convert grad100.gif grad100.gif grad100.gif grad100stack.gif

negate the gradient to make a lut:
convert grad100.gif -negate grad100_neg.gif

apply the lut to see if it will negate all 3 frames:
convert grad100stack.gif grad100_neg.gif -clut grad100stack_clut_neg.gif

result is that the output contains only one frame


On the other hand, other operators will process all frames. For example:

convert grad100stack.gif -negate grad100stack_neg.gif

does produce 3 frames for the output

Thanks

Fred

Re: enhancement suggestion for -clut

Posted: 2008-07-13T21:06:30-07:00
by anthony
That could be possible, but would not be normal practice.
The -clut operator merges two images, which means it is following the "Multi-Image Layer Operators" handling and not a simple "Image Modification Operator" such as -negate (see Types of Options.

If you want to change the way it works we have two choices...

1/ make it a composition image merge so you can then use -layers composition to apply a single 'source' image to multiple 'destination 'images. This is probably not a good idea.

2/ Change it apply the last image to all the other images.
This requires the API (command line interface) to apply it to each image, or the function in the central library modified to handle multiple image input (after the last image is removed and past to it.

What ever method is chosen, I would make the request in the developers forum. However bug fixes are always higher priority than new requests, as we just don't have the programmers needed to implement new things fast enough. I myself am now working on the third stage expansion of 'distorts' with more methods, and a related 'sparse gradient' generator.

----

HOWEVER... all is not lost. if you like to describe what type of gradient you are using to color the images, we may be able to work out an alternative method.

For example I only just finished add two new functions specifically for better recoloring of images.
+level (for de-contrasting) and +level-colors, which applies a linear color gradient to/from gray scale, or for gradient tinting images. Both are listed in the Options and IM examples, Color Modification pages.

-----

The other alternative is as you mentioned, to loop over the image frames.

However you can avoid temporary images, by using a 'film strip' technique. As outlined in Side by Side Appending.

That is
  • coalesce the animation,
  • append vertically or horizontally,
  • apply the single image operation (append in the above),
  • tile crop the image back into the original frames list
  • and optimize and save as an animation again.
the problem with this method is that you lose any individual timings the animation had, but if it is a constant time, that is not a problem.