possible bug with color reduction of PNG image
Posted: 2010-05-28T15:01:27-07:00
IM 6.6.2-0 Q16 Mac OSX Tiger.
I am not sure this a bug with color reduction or something odd in my png image.
Image:
identify -verbose
12022: ( 0, 0, 0,255) #000000 black
90: ( 0, 0, 0,136) #00000088 rgba(0,0,0,0.533333)
72: ( 0, 0, 0,238) #000000EE rgba(0,0,0,0.933333)
69: ( 0, 0, 0, 17) #00000011 rgba(0,0,0,0.0666667)
...
55: ( 0, 0, 0,153) #00000099 rgba(0,0,0,0.6)
54: ( 0, 0, 0, 51) #00000033 rgba(0,0,0,0.2)
51: ( 0, 0, 0,102) #00000066 rgba(0,0,0,0.4)
46: ( 0, 0, 0,187) #000000BB rgba(0,0,0,0.733333)
41: ( 0, 0, 0, 34) #00000022 rgba(0,0,0,0.133333)
40: ( 0, 0, 0, 68) #00000044 rgba(0,0,0,0.266667)
36: ( 0, 0, 0,221) #000000DD rgba(0,0,0,0.866667)
30: ( 0, 0, 0,119) #00000077 rgba(0,0,0,0.466667)
19: ( 0, 0, 0,170) #000000AA rgba(0,0,0,0.666667)
17: ( 0, 0, 0, 85) #00000055 rgba(0,0,0,0.333333)
31: ( 0, 17, 17,255) #001111 rgba(0,17,17,1)
...
7277: ( 0,255,255,255) #00FFFF cyan
1: ( 7,251,251,255) #07FBFB rgba(7,251,251,1)
1: ( 8,253,253,255) #08FDFD rgba(8,253,253,1)
88: ( 9, 32, 32,255) #092020 rgba(9,32,32,1)
101: ( 9,254,254,255) #09FEFE rgba(9,254,254,1)
150: ( 10, 17, 17,255) #0A1111 rgba(10,17,17,1)
3: ( 10,255,255,255) #0AFFFF rgba(10,255,255,1)
...
49: ( 31, 31, 31,255) #1F1F1F grey12
41324: (254,254,254, 0) #FEFEFE00 rgba(254,254,254,0)
26: (254,254,254,255) #FEFEFE rgba(254,254,254,1)
3305: (255, 0, 0,255) #FF0000 red
20941: (255,255,255,255) #FFFFFF white
This works but loses transparency:
convert 165805.png -depth 8 +dither -colors 20 165805_tmp20.png
or
convert 165805.png -channel rgba -alpha on -depth 8 +dither -colors 20 165805_tmp20.png
identify -verbose 165805_tmp20.png
Histogram:
54134: ( 0, 0, 0) #000000 black
7515: ( 0,254,254) #00FEFE rgb(0,254,254)
472: ( 13, 14, 14) #0D0E0E rgb(13,14,14)
632: ( 29, 38, 38) #1D2626 rgb(29,38,38)
304: ( 32,211,211) #20D3D3 rgb(32,211,211)
201: ( 62, 62, 62) #3E3E3E rgb(62,62,62)
340: ( 68, 80, 80) #445050 rgb(68,80,80)
22: ( 75, 75, 75) #4B4B4B rgb(75,75,75)
376: ( 78, 78, 78) #4E4E4E rgb(78,78,78)
327: ( 81,173,173) #51ADAD rgb(81,173,173)
161: (133,221,221) #85DDDD rgb(133,221,221)
8304: (152,254,254) #98FEFE rgb(152,254,254)
168: (155, 0, 0) #9B0000 rgb(155,0,0)
622: (165,165,165) #A5A5A5 rgb(165,165,165)
350: (213,213,213) #D5D5D5 rgb(213,213,213)
15532: (230,230,230) #E6E6E6 rgb(230,230,230)
3385: (254, 0, 0) #FE0000 rgb(254,0,0)
21074: (254,254,254) #FEFEFE rgb(254,254,254)
Not a single transparent color in the above??? Should there not be some transparency?
But this gives an error that I don't understand, although it makes an image, but again without transparency.
convert 165805.png -depth 8 +dither -colors 10 165805_tmp10.png
convert: tRNS chunk has out-of-range samples for bit_depth `165805_tmp10.png' @ warning/png.c/PNGWarningHandler/1457.]
Why am I losing the transparency? Is that because the original image has "rgba(254,254,254,0)" as the only fully transparent color and if so, then why does transparency go to black rather than white?
Any help appreciated. Perhaps I misunderstand how the color reduction should behave.
Thanks
Fred
I am not sure this a bug with color reduction or something odd in my png image.
Image:
identify -verbose
12022: ( 0, 0, 0,255) #000000 black
90: ( 0, 0, 0,136) #00000088 rgba(0,0,0,0.533333)
72: ( 0, 0, 0,238) #000000EE rgba(0,0,0,0.933333)
69: ( 0, 0, 0, 17) #00000011 rgba(0,0,0,0.0666667)
...
55: ( 0, 0, 0,153) #00000099 rgba(0,0,0,0.6)
54: ( 0, 0, 0, 51) #00000033 rgba(0,0,0,0.2)
51: ( 0, 0, 0,102) #00000066 rgba(0,0,0,0.4)
46: ( 0, 0, 0,187) #000000BB rgba(0,0,0,0.733333)
41: ( 0, 0, 0, 34) #00000022 rgba(0,0,0,0.133333)
40: ( 0, 0, 0, 68) #00000044 rgba(0,0,0,0.266667)
36: ( 0, 0, 0,221) #000000DD rgba(0,0,0,0.866667)
30: ( 0, 0, 0,119) #00000077 rgba(0,0,0,0.466667)
19: ( 0, 0, 0,170) #000000AA rgba(0,0,0,0.666667)
17: ( 0, 0, 0, 85) #00000055 rgba(0,0,0,0.333333)
31: ( 0, 17, 17,255) #001111 rgba(0,17,17,1)
...
7277: ( 0,255,255,255) #00FFFF cyan
1: ( 7,251,251,255) #07FBFB rgba(7,251,251,1)
1: ( 8,253,253,255) #08FDFD rgba(8,253,253,1)
88: ( 9, 32, 32,255) #092020 rgba(9,32,32,1)
101: ( 9,254,254,255) #09FEFE rgba(9,254,254,1)
150: ( 10, 17, 17,255) #0A1111 rgba(10,17,17,1)
3: ( 10,255,255,255) #0AFFFF rgba(10,255,255,1)
...
49: ( 31, 31, 31,255) #1F1F1F grey12
41324: (254,254,254, 0) #FEFEFE00 rgba(254,254,254,0)
26: (254,254,254,255) #FEFEFE rgba(254,254,254,1)
3305: (255, 0, 0,255) #FF0000 red
20941: (255,255,255,255) #FFFFFF white
This works but loses transparency:
convert 165805.png -depth 8 +dither -colors 20 165805_tmp20.png
or
convert 165805.png -channel rgba -alpha on -depth 8 +dither -colors 20 165805_tmp20.png
identify -verbose 165805_tmp20.png
Histogram:
54134: ( 0, 0, 0) #000000 black
7515: ( 0,254,254) #00FEFE rgb(0,254,254)
472: ( 13, 14, 14) #0D0E0E rgb(13,14,14)
632: ( 29, 38, 38) #1D2626 rgb(29,38,38)
304: ( 32,211,211) #20D3D3 rgb(32,211,211)
201: ( 62, 62, 62) #3E3E3E rgb(62,62,62)
340: ( 68, 80, 80) #445050 rgb(68,80,80)
22: ( 75, 75, 75) #4B4B4B rgb(75,75,75)
376: ( 78, 78, 78) #4E4E4E rgb(78,78,78)
327: ( 81,173,173) #51ADAD rgb(81,173,173)
161: (133,221,221) #85DDDD rgb(133,221,221)
8304: (152,254,254) #98FEFE rgb(152,254,254)
168: (155, 0, 0) #9B0000 rgb(155,0,0)
622: (165,165,165) #A5A5A5 rgb(165,165,165)
350: (213,213,213) #D5D5D5 rgb(213,213,213)
15532: (230,230,230) #E6E6E6 rgb(230,230,230)
3385: (254, 0, 0) #FE0000 rgb(254,0,0)
21074: (254,254,254) #FEFEFE rgb(254,254,254)
Not a single transparent color in the above??? Should there not be some transparency?
But this gives an error that I don't understand, although it makes an image, but again without transparency.
convert 165805.png -depth 8 +dither -colors 10 165805_tmp10.png
convert: tRNS chunk has out-of-range samples for bit_depth `165805_tmp10.png' @ warning/png.c/PNGWarningHandler/1457.]
Why am I losing the transparency? Is that because the original image has "rgba(254,254,254,0)" as the only fully transparent color and if so, then why does transparency go to black rather than white?
Any help appreciated. Perhaps I misunderstand how the color reduction should behave.
Thanks
Fred