Regression from 6.3.7.9 to 6.4.5.4 and newer in complex op

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
alex_nb

Regression from 6.3.7.9 to 6.4.5.4 and newer in complex op

Post by alex_nb »

Hello,
I'm trying to make work an application developed on a server that has version 6.3.7.9 (Debian Lenny package) on my desktop that has version 6.4.5.4 (Ubunty Jaunty Jackalope) and imagemagick is behaving differently.

That's the operation I'm doing:

convert '(' 'res.jpg' '-modulate' '100,0,100' 'resMask.png' '-matte' '-compose' 'DstIn' '-composite' ')' '(' 'res.jpg' '-fill' '#FF69CF' '-colorize' '100%' ')' '-compose' 'multiply' '-composite' 'mainBg.png' '+compose' '-composite' '-quality' '85' out.jpg

That's the (correct) output on the old version 6.3.7.9:
Image

While that's the wrong output on 6.4.5.4 (and newer, I tested also version 6.5.1.0 in Debian unstable):
Image

I suppose that in the new version there is some bug in the handling of the alpha channel, otherwise anyone can help me understand how I can revert to the old behavior?

For reference, the images used in the example are available here:
http://nb1.nibbles.it/imagemagick/regre ... mainBg.png (image with alpha channel)
http://nb1.nibbles.it/imagemagick/regre ... .4/res.jpg ("main" image)
http://nb1.nibbles.it/imagemagick/regre ... esMask.png ("mask" image, using alpha channel too)

Thanks for any help!
Alex
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Regression from 6.3.7.9 to 6.4.5.4 and newer in complex op

Post by anthony »

Can you break up the command steps to discover where it is going 'different'?

I can't guarantee that we will change it back, as it may be that something was fixed to work 'correctly' but resulted in you command not doing what you expect.

We may need some source images as well so we can try out the steps ourselves.


Remember we need to be able to repeat your steps to help you solve the problem.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
alex_nb

Re: Regression from 6.3.7.9 to 6.4.5.4 and newer in complex op

Post by alex_nb »

Remember we need to be able to repeat your steps to help you solve the problem.
Hello Anthony,
I've attached all the source images, you should be able to repeat the operation without any problem, please tell me if you need something else.

As for breaking down the steps I'm not expert enough to understand how to do it but I'll try...
alex_nb

Re: Regression from 6.3.7.9 to 6.4.5.4 and newer in complex op

Post by alex_nb »

A first problem seems to arise in the first step, the "modulate".
Just doing the following command gives a different result between the two versions:
convert 'res.jpg' '-modulate' '100,0,100' 'resMask.png' out.jpg

In particular this is the output in version 6.3.7.9:
Image

while this is the output on the current version:
Image

For the record I repost the links to the images used for the test:
http://nb1.nibbles.it/imagemagick/regre ... .4/res.jpg
http://nb1.nibbles.it/imagemagick/regre ... esMask.png
alex_nb

Re: Regression from 6.3.7.9 to 6.4.5.4 and newer in complex op

Post by alex_nb »

Ok, the biggest problem is in the last part of the process, I tracked it down to this:

convert res.jpg mainBg.png +compose -composite out.jpg

That gives two completely different results, this is the old one (correct, at least for what we use it :)):
Image
i.e.: the image is "masked" following the alpha channel of mainBg.png

while this the output in the newer versions of imagemagick:
Image
i.e.: the image is left untouched

I suppose this is a bug, otherwise it's a big change in behavior and I would be very pleased to know how to manage to obtain the same result in current version of imagemagick :)

Thanks!
Alex
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Regression from 6.3.7.9 to 6.4.5.4 and newer in complex op

Post by fmw42 »

Not an expert on this but try:

convert res.jpg mainBg.png +compose -compose over -composite out.jpg
alex_nb

Re: Regression from 6.3.7.9 to 6.4.5.4 and newer in complex op

Post by alex_nb »

Thanks for your hint, this seems to work!

Should this be considered a regression anyway?
Or should it be documented the new behavior of some commands or the different defaults?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Regression from 6.3.7.9 to 6.4.5.4 and newer in complex op

Post by anthony »

Replace +compose with -compose over

The +compose means use the compose stored in the images matedata.
It no longer means default to over.

This was to allow more correct handling of -flatten with photoshop layers


As for modulate I note in the Change log...

2008-04-20 6.4.0-10 Chris Madison <madisonblu@hotma...>
* Default to HSL colorspace when modulating (reference
viewtopic.php?f=1&t=11073).

but also Remember this discussion....
viewtopic.php?t=12640
which showed the problems modulate had when using HSL.

I myself have not noted any difference in modulates results. but then I don't have a lot of examples of using it.
Modulate Brightness, Saturation, and Hue
http://www.imagemagick.org/Usage/color/#modulate
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
alex_nb

Re: Regression from 6.3.7.9 to 6.4.5.4 and newer in complex op

Post by alex_nb »

Thanks to everybody for the explanations, I think I solved all the problems.

Sorry for having overlooked the changelogs, I'll try to do my best in the future :-)
Post Reply