Page 1 of 2
Read a grayscale png.
Posted: 2015-05-19T08:13:11-07:00
by wizard29
Hi, everyone.
After last update of IM I found a some weird behaviour of file opening. The
grayscale image is opened as totally white image but it is wrong.
Before I used IM "6,9,0,7" version and Magick++ API under OS Windows 7 and everything works fine for png images.
Now I try to use the IM "6,9,1,3" version.
Re: Read a grayscale png.
Posted: 2015-05-19T08:30:13-07:00
by glennrp
I wasn't able to reproduce the problem on Ubuntu commandline interface with IM-6.9.1-3 downloaded today. What is your libpng version? run "convert -list format | grep PNG" to find out.
Re: Read a grayscale png.
Posted: 2015-05-19T08:44:29-07:00
by wizard29
libpng version is 1.6.12.
Re: Read a grayscale png.
Posted: 2015-05-19T08:51:09-07:00
by wizard29
convert.exe utility makes the same result (convert.exe
grayscale.png grayscale.jpg).
Re: Read a grayscale png.
Posted: 2015-05-19T09:00:18-07:00
by wizard29
By the way, the same issue I have under Mac OS X 10.10.3.
Re: Read a grayscale png.
Posted: 2015-05-19T14:02:55-07:00
by glennrp
I relinked my IM-6.9.1-3 with libpng-1.16.12 but still could not replicate your result. I'm getting the expected scribbly drawing.
pngcheck doesn't show anything peculiar about the file:
- glenn.rp> pngcheck -v *7.png
File: h777.png (12176 bytes)
chunk IHDR at offset 0x0000c, length 13
426 x 227 image, 8-bit grayscale, non-interlaced
chunk pHYs at offset 0x00025, length 9: 2835x2835 pixels/meter (72 dpi)
chunk iCCP at offset 0x0003a, length 792
profile name = Photoshop ICC profile, compression method = 0 (deflate)
compressed profile = 769 bytes
chunk cHRM at offset 0x0035e, length 32
White x = 0.31269 y = 0.32899, Red x = 0.63999 y = 0.33001
Green x = 0.3 y = 0.6, Blue x = 0.15 y = 0.05999
chunk IDAT at offset 0x0038a, length 11250
zlib: deflated, 32K window, maximum compression
chunk IEND at offset 0x02f88, length 0
No errors detected in h777.png (6 chunks, 87.4% compression).
Perhaps there is some problem with the color managment chunks (iCCP and cHRM). During conversion
to JPEG format, the cHRM chunk gets discarded but the iCCP chunk is copied into the JPEG.
Re: Read a grayscale png.
Posted: 2015-05-20T01:05:21-07:00
by wizard29
Glenn,
Thank you for the response. I think you right. Looks like a conversion problem.
Could someone to clarify this issue?
Re: Read a grayscale png.
Posted: 2015-05-20T01:20:11-07:00
by wizard29
When I tried to make conversion from grayscale.png to grayscale1.png I get a warning message that looks like:
convert.exe: profile 'icc': 'GRAY': Gray color space not permitted on RGB PNG `g
rayscale1.png' @ warning/png.c/MagickPNGWarningHandler/1656.
And totally white grayscale1.png as result.
Re: Read a grayscale png.
Posted: 2015-05-20T01:31:02-07:00
by wizard29
if I try to convert:
convert.exe
grayscale.tif grayscale1.png
everything works as expected. But I get the same warning exception.
Re: Read a grayscale png.
Posted: 2015-05-20T01:51:29-07:00
by snibgo
"identify -verbose" shows it contains an ICC profile. Depending on what you are trying to do, you might want to convert it to sRGB and strip the profile:
Code: Select all
convert grayscale.tif -profile sRGB.icc -strip out.tif
Re: Read a grayscale png.
Posted: 2015-05-20T02:01:59-07:00
by wizard29
Snigbo,
Thank you.
The problem is conversion from the grayscale.png. For other grayscale images everything works as expected. I have checked:
grayscale.bmp
grayscale.jpg
grayscale.png
grayscale.tif
All works as I expected except the grayscale.png. I make conversion from all grayscale.* images to the sRGB color space.
Re: Read a grayscale png.
Posted: 2015-05-20T02:19:31-07:00
by wizard29
I ran the "identify" utility for the grayscale.png. Result of color map looks weird. Perhaps it is not substantively:
png.txt
jpg.txt
Re: Read a grayscale png.
Posted: 2015-05-20T02:34:19-07:00
by snibgo
Your png.txt and jpg.txt both contain:
Code: Select all
icc:description: Dot Gain 20%
icc:manufacturer: Dot Gain 20%
So they contain embedded profiles and have NOT been converted to sRGB.
When you convert to bmp or other format that can't store colour profiles, the embedded profile is silently ignored.
So your bmp version looks different (on Firefox on my computer) to your png version. Firefox recognises the profile and converts it to sRGB.
Re: Read a grayscale png.
Posted: 2015-05-20T02:56:15-07:00
by wizard29
The "convert.exe grayscale.png -profile sRGB.icc grayscale1.png" gives expected result.
Re: Read a grayscale png.
Posted: 2015-05-20T02:56:36-07:00
by wizard29
Thank you,
Snigbo.