Page 1 of 1

Issue with "-gamma" operator in IM 7...

Posted: 2017-07-14T08:25:11-07:00
by GeeMack
Using IM 7.0.6-0 HDRI on Windows 10 64...

The "-gamma" operator, according to this LINK and this LINK, should allow for adjusting the gamma separately for each of the R, G, and B channels. Using IM 7.0.6-0, the first argument to "-gamma" adjusts all channels, and any following arguments are ignored. The output of the following commands, although they should produce different results, are identical...

Code: Select all

magick logo: -gamma 1,1,1 result_111_v7.png

magick logo: -gamma 1,1,2 result_112_v7.png

magick logo: -gamma 1,2,2 result_122_v7.png
These two commands should not generate identical results, but they do...

Code: Select all

magick logo: -gamma 2 result_1arg.png

magick logo: -gamma 2,1,1 result_3args.png
With the following commands using IM 6.9.8-10, the gamma adjustment is done on a per channel basis as expected...

Code: Select all

convert logo: -gamma 1,1,1 result_111_v6.png

convert logo: -gamma 1,1,2 result_112_v6.png

convert logo: -gamma 1,2,2 result_122_v6.png

Re: Issue with "-gamma" operator in IM 7...

Posted: 2017-07-14T08:50:57-07:00
by fmw42
For IM 7, try adding -channel rgb before -gamma. Does that help? I would hope that it would not be necessary to do that. But IM 7 sometimes needs an explicit -channel settings.

Re: Issue with "-gamma" operator in IM 7...

Posted: 2017-07-14T11:19:35-07:00
by GeeMack
fmw42 wrote: 2017-07-14T08:50:57-07:00For IM 7, try adding -channel rgb before -gamma. Does that help? I would hope that it would not be necessary to do that. But IM 7 sometimes needs an explicit -channel settings.
No change. I can't find a way to make the "-gamma" operator act on the color channel arguments as described in the docs. With one argument, it adjusts the gamma for all channels. With more than one argument it will still adjust all channels according to the first argument and ignore the rest.

This has been an issue since at least v7.0.5 as I described in THIS post. The only way to get it to act on individual channels is to work it with something like "... -channel R -gamma 1.23 +channel ..." for each color, but that seems like it shouldn't be necessary. This is a function I've used occasionally since IM6, and it still works as expected in IM6. It would be disappointing if this color channel functionality has been removed in IM7.

Re: Issue with "-gamma" operator in IM 7...

Posted: 2017-07-14T14:54:15-07:00
by fmw42
If my suggestion did not work, then this is a bug. I have confirmed at least one of your commands in IM 7 does not behave correctly.

Code: Select all

magick logo: -gamma 1,2,2 result_122_v7.png
and one of the developers needs to check it

Re: Issue with "-gamma" operator in IM 7...

Posted: 2017-07-14T17:54:48-07:00
by magick
Try this command:

Code: Select all

magick logo: -channel blue -gamma 2 result_112_v7.png

Re: Issue with "-gamma" operator in IM 7...

Posted: 2017-07-14T18:37:27-07:00
by fmw42
magick wrote: 2017-07-14T17:54:48-07:00 Try this command:

Code: Select all

magick logo: -channel blue -gamma 2 result_112_v7.png
Has -gamma changed in IM 7? Does it not allow 3 arguments for different values for each channel?

This does not work:

Code: Select all

magick logo: -channel rgb -gamma 1,2,2 result_122_v7.png
I treats all channels the same as if with -gamma 1 and is ignoring the other arguments. I do not see anything about changes to -gamma in the porting docs.

Re: Issue with "-gamma" operator in IM 7...

Posted: 2017-07-15T04:29:53-07:00
by magick
The three argument -gamma option is not supported in IMv7 as a consequence of the enhanced channel handling supported in IMv7 vs IMv6. The change is now documented in the porting guide @ https://www.imagemagick.org/script/porting.php. To modify the channels with different gamma settings in IMv7, use:

Code: Select all

magick logo: -channel red -gamma 0.8 -channel green -gamma 1.2 -channel blue 1.6 result_122_v7.png

Re: Issue with "-gamma" operator in IM 7...

Posted: 2017-07-15T10:24:13-07:00
by fmw42
Thanks for the clarification