2

I am generating a GIF from a sequence of JPEGs.

I am using the brightness-contrast option for each image like so:

convert -loop 0 -layers optimize
-delay 10 thing1.jpg -brightness-contrast 5x5 
-delay 10 thing2.jpg -brightness-contrast 5x5
-delay 10 thing3.jpg -brightness-contrast 5x5
-delay 10 thing4.jpg -brightness-contrast 5x5
thing.gif

What I'm noticing is that the brightness and contrast changes seem to be applied cumulatively, with the first image being the most affected. What I'm looking for is to apply the same brightness-contrast adjustment to all images, but instead, the first image appears to be increased by 40%, the second by 30%, etc.

Has anyone else experience this? Is there a way to apply the same change equally to all individual images that are used to build the GIF?

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
mhawthorne
  • 43
  • 5

1 Answers1

2

See my answers for these questions:

Because -brightness-contrast is an image operator (not an image setting) it is applied immediately to all currently loaded images (and then forgotten):

  1. When you apply it the first time, only thing1.jpg is loaded. The operator is applied to this one image.

  2. When you apply it the second time, thing2.jpg is loaded, but also the (already modified!) thing1.jpg is still loaded. The operator is applied to both these images.

To explain how your + my versions of the command works, be aware of this:

  • -loop 0 : is an image setting
  • -delay 10 : is an image setting
  • -brightness-contrast 5x5 : is an image operator
  • -layers optimize : is an image sequence operator

Therefor, you should try this:

convert -loop 0                  \
        -delay 10                \
         thing1.jpg              \
         thing2.jpg              \
         thing3.jpg              \
         thing4.jpg              \
        -brightness-contrast 5x5 \
        -layers optimize         \
         thing.gif

If you need to apply different values, but non-accumulatively, controlling each level of brightness-contrast separately, you should use the \(.....\) bracketing for 'aside'-processing of images:

convert -loop 0                                                 \
         \( thing1.jpg -delay 10  -brightness-contrast 5x5 \)   \
         \( thing2.jpg -delay 20  -brightness-contrast 10x20 \) \
         \( thing3.jpg -delay 100 -brightness-contrast 10% \)   \
         \( thing4.jpg -delay 1   -brightness-contrast 0x50 \)  \
        -layers optimize                                        \
         thing.gif
Community
  • 1
  • 1
Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345