Bad Colors with colorspace and gamma options

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
jake9wi
Posts: 5
Joined: 2019-04-07T07:52:35-07:00
Authentication code: 1152
Location: NORTHWEST INDIANA

Bad Colors with colorspace and gamma options

Post by jake9wi » 2019-04-07T09:15:35-07:00

On windows seven x64 using version 7.0.8-3 the image returns with good colors but with version 7.0.8-38 colors are distorted.

link to images: https://www.dropbox.com/sh/lzbule9mcn78 ... vyIKa?dl=0

Code: Select all

magick.exe original_fdc_o_ea.png ^
-colorspace CIELAB -intent Relative ^
-colorspace sRGB -intent Relative ^
-gamma 0.8 -type Truecolor  test_708-38_fdc_o_ea.PNG"

User avatar
dlemstra
Posts: 1563
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Bad Colors with colorspace and gamma options

Post by dlemstra » 2019-04-07T13:56:17-07:00

Can you reproduce this issue with ImageMagick 7.0.8-39 that has just been released?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

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

Re: Bad Colors with colorspace and gamma options

Post by fmw42 » 2019-04-07T14:12:45-07:00

It does not reproduce the original colors for me in 7.0.8.39 Q16 Mac OSX. But does with IM 6.9.10.39 Q16.

jake9wi
Posts: 5
Joined: 2019-04-07T07:52:35-07:00
Authentication code: 1152
Location: NORTHWEST INDIANA

Re: Bad Colors with colorspace and gamma options

Post by jake9wi » 2019-04-07T15:23:39-07:00

Yes, 7.0.8-39 still produces the error.

User avatar
magick
Site Admin
Posts: 11018
Joined: 2003-05-31T11:32:55-07:00

Re: Bad Colors with colorspace and gamma options

Post by magick » 2019-04-08T04:11:17-07:00

What do you get for these commands:

Code: Select all

$ compare -metric rmse  test_708-38_fdc_o_ea.PNG  original_fdc_o_ea.png null:
1567.21 (0.023914)

$ compare -metric rmse test_708-03_fdc_o_ea.PNG  original_fdc_o_ea.png x:
1567.21 (0.023914) 

$ compare -metric rmse  test_708-38_fdc_o_ea.PNG  test_708-03_fdc_o_ea.PNG null:
0.606276 (9.25117e-06)
Which suggests ImageMagick 7.0.8-39 is producing nearly the same exact results as 7.0.8-3. If you get different results, the problem may be a Windows/Mac issue.

jake9wi
Posts: 5
Joined: 2019-04-07T07:52:35-07:00
Authentication code: 1152
Location: NORTHWEST INDIANA

Re: Bad Colors with colorspace and gamma options

Post by jake9wi » 2019-04-08T07:31:34-07:00

Code: Select all

A:\z_zip\imagemagick\708-39>compare.exe -metric rmse test_708-38_fdc_o_ea.PNG original_fdc_o_ea.png null:
13129.2 (0.200338)

A:\z_zip\imagemagick\708-39>compare.exe -metric rmse test_708-03_fdc_o_ea.PNG original_fdc_o_ea.png null:
1567.21 (0.023914)

A:\z_zip\imagemagick\708-39>compare.exe -metric rmse test_708-38_fdc_o_ea.PNG test_708-03_fdc_o_ea.PNG null:
13035.3 (0.198906)

snibgo
Posts: 11932
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Bad Colors with colorspace and gamma options

Post by snibgo » 2019-04-08T08:23:56-07:00

jake9wi wrote:magick.exe original_fdc_o_ea.png ^
-colorspace CIELAB -intent Relative ^
-colorspace sRGB -intent Relative ^
-gamma 0.8 -type Truecolor test_708-38_fdc_o_ea.PNG"
I suggest you simplify the command. What is the simplest that shows the problem?

You are not using "-profile", so "-intent" should do nothing.

If the input is sRGB, then "-colorspace CIELAB -colorspace sRGB" should do nothing.

"-type Truecolor" should not make a significant difference.

"-gamma 0.8" will make a difference, but should be the same in each version. Try with "-gamma 1.0", which should not change the image.
snibgo's IM pages: im.snibgo.com

jake9wi
Posts: 5
Joined: 2019-04-07T07:52:35-07:00
Authentication code: 1152
Location: NORTHWEST INDIANA

Re: Bad Colors with colorspace and gamma options

Post by jake9wi » 2019-04-08T08:42:00-07:00

The unsimplified command i am using is this:

Code: Select all

magick.exe ..\fdc_o_ea.png ^
-colorspace CIELAB -intent Relative ^
-filter hermite -distort resize "1000x744!" ^
-colorspace sRGB -intent Relative ^
-gamma 0.8 -quality 00 -type TrueColor fdc_o_ea.PNG
Dropping 'truecolor' and 'intent Relative ' still produces the error:

Code: Select all

magick.exe original_fdc_o_ea.png ^
-colorspace CIELAB ^
-colorspace sRGB ^
-gamma 0.8 test_708-38_fdc_o_ea.PNG"
If I set gamma to one or drop '-colorspace CIELAB' the error is not produced.

snibgo
Posts: 11932
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Bad Colors with colorspace and gamma options

Post by snibgo » 2019-04-08T09:11:07-07:00

jake9wi wrote:...or drop '-colorspace CIELAB' the error is not produced.
Good. That suggests that "-colorspace CIELAB" is changing the gamma setting, but "-colorspace sRGB" isn't changing it back. This should help the developers find the bug.

Meanwhile, as a workaround, I suggest you don't use "-gamma 0.8". Instead, use "-evaluate Pow 1.25". Does that work correctly in both versions?

(Note that 1/0.8 = 1.25.)
snibgo's IM pages: im.snibgo.com

jake9wi
Posts: 5
Joined: 2019-04-07T07:52:35-07:00
Authentication code: 1152
Location: NORTHWEST INDIANA

Re: Bad Colors with colorspace and gamma options

Post by jake9wi » 2019-04-08T10:06:01-07:00

Using '-evaluate Pow 1.25' still produces the error in ver38 & 39, '-evaluate Pow 1.00' does not produce the error.

In ver3 '-evaluate Pow 1.25' works good like gamma 0.8.

snibgo
Posts: 11932
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Bad Colors with colorspace and gamma options

Post by snibgo » 2019-04-08T10:17:01-07:00

Okay. This is weird, probably a bug in 7.0.8-38 and -39, possibly restricted to Windows and Mac versions. I'll leave it to the developers.
snibgo's IM pages: im.snibgo.com

Post Reply