Page 1 of 1

possible bug saving transparent images IM 6.9.1.9 Q16 Mac OSX

Posted: 2015-07-21T10:22:55-07:00
by fmw42
There seems to be an issue with the following command saving the transparent image. The histogram before the write to output is fine, but after saving the image (whether png or tif), the base image has changed from 170 to about 220.


It was fine in 6.9.1.4 and started and continues on from 6.9.1.5 It also fails 6.9.1.2 and 6.9.1.3 versions, but is fine before that.

Note: #AAAAAAB8 should be rgba(170,170,170,0.72) or rgba(170,170,170,184) apart from antialising the edges.

Code: Select all

convert -background transparent -fill '#AAAAAAB8' -font Arial \
-pointsize 50 -depth 8 label:'Test Stamp' -resize 1024x768 \
-format "%c" -write histogram:info: test6.png
152131: ( 0, 0, 0, 0) #00000000 transparent
1: (170,170,170, 0) #AAAAAA00 srgba(170,170,170,1.5259e-05)
13321: (170,170,170, 0) #AAAAAA00 srgba(170,170,170,0)
2107:] (170,170,170,184) #AAAAAAB8 srgba(170,170,170,0.721569)
223: (170,170,170,184) #AAAAAAB8 srgba(170,170,170,0.721584)
203: (170,170,170,184) #AAAAAAB8 srgba(170,170,170,0.721599)
186: (170,170,170,185) #AAAAAAB9 srgba(170,170,170,0.723766)
186: (170,170,170,184) #AAAAAAB8 srgba(170,170,170,0.721614)
186: (170,170,170,184) #AAAAAAB8 srgba(170,170,170,0.721553)
156: (170,170,170,184) #AAAAAAB8 srgba(170,170,170,0.721645)
150: (170,170,170,185) #AAAAAAB9 srgba(170,170,170,0.724651)
150: (170,170,170,184) #AAAAAAB8 srgba(170,170,170,0.721706)
148: (170,170,170,185) #AAAAAAB9 srgba(170,170,170,0.726848)
141: (170,170,170,184) #AAAAAAB8 srgba(170,170,170,0.722545)
139: (170,170,170,184) #AAAAAAB8 srgba(170,170,170,0.722011)
138: (170,170,170,186) #AAAAAABA srgba(170,170,170,0.728862)
137: (170,170,170,174) #AAAAAAAE srgba(170,170,170,0.680598)
137: (170,170,170,102) #AAAAAA66 srgba(170,170,170,0.398566)

Code: Select all

convert test6.png -format "%c" histogram:info:

152131: ( 0, 0, 0, 0) #00000000 graya(0,0)
1: (220,220,220,197) #DCDCDCC5 graya(220,0.772549)
3: (221,221,221,196) #DDDDDDC4 graya(221,0.768627)
1: (221,221,221,197) #DDDDDDC5 graya(221,0.772549)
6: (222,222,222,195) #DEDEDEC3 graya(222,0.764706)
1: (222,222,222,196) #DEDEDEC4 graya(222,0.768627)
5: (223,223,223,194) #DFDFDFC2 graya(223,0.760784)
4: (223,223,223,195) #DFDFDFC3 graya(223,0.764706)
10: (224,224,224,193) #E0E0E0C1 graya(224,0.756863)
6: (224,224,224,194) #E0E0E0C2 graya(224,0.760784)
9: (225,225,225,193) #E1E1E1C1 graya(225,0.756863)
6: (225,225,225,192) #E1E1E1C0 graya(225,0.752941)
32: (226,226,226,192) #E2E2E2C0 graya(226,0.752941)
7: (226,226,226,191) #E2E2E2BF graya(226,0.74902)
236: (227,227,227,191) #E3E3E3BF graya(227,0.74902)
277: (228,228,228,190) #E4E4E4BE graya(228,0.745098)
9: (228,228,228,191) #E4E4E4BF graya(228,0.74902)
275: (229,229,229,189) #E5E5E5BD graya(229,0.741176)
113: (229,229,229,190) #E5E5E5BE graya(229,0.745098)
527: (230,230,230,188) #E6E6E6BC graya(230,0.737255)

Re: possible bug saving transparent images IM 6.9.1.9 Q16 Mac OSX

Posted: 2015-07-23T09:27:09-07:00
by 246246
6.9.1-9 Q16 on Windows:

Code: Select all

convert -background transparent -resize 1024x768 -depth 8 -fill "rgba(170,170,170,184)" -font Arial -pointsize 50 label:"Test Stamp" PNG:- | identify -verbose -
...
Colors: 257
Histogram:
140491: ( 0, 0, 0, 0) #00000000 graya(0,0)
1034: (170,170,170,255) #AAAAAAFF graya(170,1)
1339: (171,171,171,253) #ABABABFD graya(171,0.992157)
871: (171,171,171,254) #ABABABFE graya(171,0.996078)
1292: (172,172,172,252) #ACACACFC graya(172,0.988235)
2530: (173,173,173,250) #ADADADFA graya(173,0.980392)
1959: (173,173,173,251) #ADADADFB graya(173,0.984314)
3994: (174,174,174,249) #AEAEAEF9 graya(174,0.976471)
...

whereas

Code: Select all

convert -background transparent -resize 1024x768 -depth 8 -fill "#AAAAAAB8" -font Arial -pointsize 50 label:"Test Stamp" PNG:- | identify -verbose -
...
Colors: 199
Histogram:
140500: ( 0, 0, 0, 0) #00000000 graya(0,0)
1: (220,220,220,197) #DCDCDCC5 graya(220,0.772549)
5: (221,221,221,196) #DDDDDDC4 graya(221,0.768627)
10: (222,222,222,195) #DEDEDEC3 graya(222,0.764706)
11: (223,223,223,194) #DFDFDFC2 graya(223,0.760784)
21: (225,225,225,193) #E1E1E1C1 graya(225,0.756863)
34: (226,226,226,192) #E2E2E2C0 graya(226,0.752941)
253: (227,227,227,191) #E3E3E3BF graya(227,0.74902)
...

At least, it seems there is a parse problem.

[EDIT]
Checked after this bug is fixed in 6.9.1-10, I recognized rgba(170,170,170,184) is treated as if it were rgba(170,170,170,1.0),
So when we need to use rgba(R,G,B,A) syntax, A must be between 0 and 1, in this case rgba(170,170,170,0.72) produces the same result with #AAAAAAB8.

Re: possible bug saving transparent images IM 6.9.1.9 Q16 Mac OSX

Posted: 2015-07-23T17:00:19-07:00
by magick
Try this command:
  • convert -background transparent -fill '#AAAAAAB8' -font Arial -pointsize 50 -depth 8 label:'Test Stamp' -resize 1024x768 \
    -format "%c" -write histogram:info: png32:test6.png

Re: possible bug saving transparent images IM 6.9.1.9 Q16 Mac OSX

Posted: 2015-07-23T17:32:25-07:00
by fmw42
magick wrote:Try this command:
  • convert -background transparent -fill '#AAAAAAB8' -font Arial -pointsize 50 -depth 8 label:'Test Stamp' -resize 1024x768 \
    -format "%c" -write histogram:info: png32:test6.png
The command works.

But why should a conversion to gray Luma (not luminance) change the gray values. Do you mean linear luminance with gamma=1 or nonlinear luma with gamma=0.4545. If you convert by the rec709luma formula to gray without modifying the gamma, the gray value will not be changed so long as the weights add to unity. What am I not understanding?

Re: possible bug saving transparent images IM 6.9.1.9 Q16 Mac OSX

Posted: 2015-07-23T18:37:28-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.9.1-10 Beta, available by sometime tomorrow. Thanks.