Read a grayscale png.
-
- Posts: 58
- Joined: 2014-03-21T00:40:16-07:00
- Authentication code: 6789
- Location: Russia, Saint Petersburg
- Contact:
Read a grayscale png.
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.
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.
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.
-
- Posts: 58
- Joined: 2014-03-21T00:40:16-07:00
- Authentication code: 6789
- Location: Russia, Saint Petersburg
- Contact:
Re: Read a grayscale png.
libpng version is 1.6.12.
-
- Posts: 58
- Joined: 2014-03-21T00:40:16-07:00
- Authentication code: 6789
- Location: Russia, Saint Petersburg
- Contact:
Re: Read a grayscale png.
convert.exe utility makes the same result (convert.exe grayscale.png grayscale.jpg).
-
- Posts: 58
- Joined: 2014-03-21T00:40:16-07:00
- Authentication code: 6789
- Location: Russia, Saint Petersburg
- Contact:
Re: Read a grayscale png.
By the way, the same issue I have under Mac OS X 10.10.3.
Re: Read a grayscale png.
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:
to JPEG format, the cHRM chunk gets discarded but the iCCP chunk is copied into the JPEG.
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).
to JPEG format, the cHRM chunk gets discarded but the iCCP chunk is copied into the JPEG.
-
- Posts: 58
- Joined: 2014-03-21T00:40:16-07:00
- Authentication code: 6789
- Location: Russia, Saint Petersburg
- Contact:
Re: Read a grayscale png.
Glenn,
Thank you for the response. I think you right. Looks like a conversion problem.
Could someone to clarify this issue?
Thank you for the response. I think you right. Looks like a conversion problem.
Could someone to clarify this issue?
-
- Posts: 58
- Joined: 2014-03-21T00:40:16-07:00
- Authentication code: 6789
- Location: Russia, Saint Petersburg
- Contact:
Re: Read a grayscale png.
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.
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.
-
- Posts: 58
- Joined: 2014-03-21T00:40:16-07:00
- Authentication code: 6789
- Location: Russia, Saint Petersburg
- Contact:
Re: Read a grayscale png.
if I try to convert:
convert.exe grayscale.tif grayscale1.png
everything works as expected. But I get the same warning exception.
convert.exe grayscale.tif grayscale1.png
everything works as expected. But I get the same warning exception.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Read a grayscale png.
"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
snibgo's IM pages: im.snibgo.com
-
- Posts: 58
- Joined: 2014-03-21T00:40:16-07:00
- Authentication code: 6789
- Location: Russia, Saint Petersburg
- Contact:
Re: Read a grayscale png.
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.
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.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Read a grayscale png.
Your png.txt and jpg.txt both contain:
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.
Code: Select all
icc:description: Dot Gain 20%
icc:manufacturer: Dot Gain 20%
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.
snibgo's IM pages: im.snibgo.com
-
- Posts: 58
- Joined: 2014-03-21T00:40:16-07:00
- Authentication code: 6789
- Location: Russia, Saint Petersburg
- Contact:
Re: Read a grayscale png.
The "convert.exe grayscale.png -profile sRGB.icc grayscale1.png" gives expected result.
-
- Posts: 58
- Joined: 2014-03-21T00:40:16-07:00
- Authentication code: 6789
- Location: Russia, Saint Petersburg
- Contact:
Re: Read a grayscale png.
Thank you,
Snigbo.
Snigbo.