Linear Gray MIFF seems to be mistaken as "sGray" in 6.7.6-6

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
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Linear Gray MIFF seems to be mistaken as "sGray" in 6.7.6-6

Post by henrywho »

Code: Select all

convert.exe rings_lg_orig.png -colorspace RGB -distort resize 16% -colorspace sRGB -quality 95% t01.jpg

convert.exe rings_lg_orig.png -colorspace RGB -distort resize 16% t02.mpc
convert.exe t02.mpc -colorspace sRGB -quality 95% t02.jpg

convert.exe rings_lg_orig.png -colorspace RGB -distort resize 16% t03.miff
convert.exe t03.miff -colorspace sRGB -quality 95% t03a.jpg
convert.exe t03.miff -set colorspace RGB -colorspace sRGB -quality 95% t03b.jpg
t01.jpg, t02.jpg, t03b.jpg all looks okay.
t03a.jpg is very dark, as if "-colorspace sRGB" is not doing anything.

I thought MIFF carries all necessary information, including its colorspace.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Linear Gray MIFF seems to be mistaken as "sGray" in 6.7.

Post by magick »

We can reproduce the problem you reported and have a patch. Look for it in ImageMagick 6.7.6-7 Beta within a day or two. Thanks.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Linear Gray MIFF seems to be mistaken as "sGray" in 6.7.

Post by anthony »

magick wrote:We can reproduce the problem you reported and have a patch. Look for it in ImageMagick 6.7.6-7 Beta within a day or two. Thanks.
The problem is that MIFF is being saved as "Gray" whcih does not define if it is linear Gray or sRGB type Gray.

It basically makes that case that a 'sGray' colorspace is needed.

The same thing happens for TXT: images.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: Linear Gray MIFF seems to be mistaken as "sGray" in 6.7.

Post by henrywho »

Indeed, we have at least four combinations:

1) Linear Gray
2) S-Gray
3) Gray-only color image in Linear RGB
4) Gray-only color image in sRGB

Imagemagick will auto-magically convert (3)/(4) to (1)/(2), for some rationale I don't really understand.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Linear Gray MIFF seems to be mistaken as "sGray" in 6.7.

Post by anthony »

The reason for the change is default format handling in that it tried to make a MIFF image
(or PNG image) smaller by saving it as grayscale, with a single color channel (gray) instead of three color channels.

That is it tried to make the save file 1/3 the size with savings in disk I/O times, disk space, and data handling.

It was always present, it was just before the conversion from a input sRGB to linear RGB was very uncommon, and the colorspace converter think Gray as being linear Gray (rightly so).
because of this it was very rare to encounter it. Now it isn't so rare!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply