PNG and gif issues

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
straycat264
Posts: 5
Joined: 2011-02-16T10:16:54-07:00
Authentication code: 8675308

PNG and gif issues

Post by straycat264 »

Version 6.6.7-7

convert -size 20x20 xc:#eeeeee test.png
Produces this:

Image

Interestingly, I get this effect for grays - put in another colour like #eeeeef, and it's fine.

On the gif front:

convert -size 11x21 xc:transparent test.gif

gets me this: Image
If I increase the size to 12x21 or 11x22, it's fine, and I just get a transparent gif.

I'm finding this confusing (and it's causing me a lot of headaches) - but it's consistent across several machines, on Windows 7, and 2003 Server.
The gif bug was present as early as 6.6.3 - possibly earlier.

Any suggestions would be very much welcomed.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PNG and gif issues

Post by fmw42 »

I get different but similar results on IM 6.6.7.7 Q16 Mac OSX tiger PowerPC

In the PNG case the image is 50/50 split down middle vertically with two shades of gray (black and gray=238)

convert -size 20x20 xc:"#eeeeee" test.png
identify -verbose test.png
Image: test.png
Format: PNG (Portable Network Graphics)
Class: PseudoClass
Geometry: 20x20+0+0
Resolution: 72x72
Print size: 0.277778x0.277778
Units: Undefined
Type: Grayscale
Base type: Grayscale
Endianess: Undefined
Colorspace: Gray
Depth: 8/4-bit
Channel depth:
gray: 4-bit
Channel statistics:
Gray:
min: 0 (0)
max: 238 (0.933333)
mean: 119 (0.466667)
standard deviation: 119 (0.466667)
kurtosis: -2
skewness: 0
Histogram:
200: ( 0, 0, 0) #000000 black
200: (238,238,238) #EEEEEE gray(238,238,238)



In the GIF case, I just get a black image as he does but with one transparent pixel at 0,0 (upper left corner)

convert -size 11x21 xc:transparent test.gif
identify -verbose test.gif
Image: test.gif
Format: GIF (CompuServe graphics interchange format)
Class: PseudoClass
Geometry: 11x21+0+0
Resolution: 72x72
Print size: 0.152778x0.291667
Units: Undefined
Type: Bilevel
Base type: Bilevel
Endianess: Undefined
Colorspace: RGB
Depth: 8/1-bit
Channel depth:
gray: 1-bit
alpha: 1-bit
Channel statistics:
Gray:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: -0 (-0)
kurtosis: 0
skewness: 0
Alpha:
min: 0 (0)
max: 255 (1)
mean: 253.896 (0.995671)
standard deviation: 16.7414 (0.0656526)
kurtosis: 226.004
skewness: 15.0998
Alpha: none #00000000
Histogram:
230: ( 0, 0, 0,255) #000000 black
1: ( 0, 0, 0, 0) #00000000 none
straycat264
Posts: 5
Joined: 2011-02-16T10:16:54-07:00
Authentication code: 8675308

Re: PNG and gif issues

Post by straycat264 »

Probably no need to confirm this, as I doubt there was time to address anything, but the same results hold true for 6.6.7-8
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: PNG and gif issues

Post by glennrp »

Yes, still there. I haven't yet figured out how to fix it without breaking other parts.
Using -define PNG:color-type=3 works around it. The error seems to be in the code that
writes 4-bit grayscale PNGs.
straycat264
Posts: 5
Joined: 2011-02-16T10:16:54-07:00
Authentication code: 8675308

Re: PNG and gif issues

Post by straycat264 »

glennrp wrote:Using -define PNG:color-type=3 works around it.
OK... thanks. Now I just have to figure out how to implement that using JMagick (or, failing that, the MagickCore API)... any pointers welcome ;)

Any good workarounds for the gif issue?
straycat264
Posts: 5
Joined: 2011-02-16T10:16:54-07:00
Authentication code: 8675308

Re: PNG and gif issues

Post by straycat264 »

OK - to answer my own question - I found setMagickOption, and added it to JMagick. colour-type 3 wasn't viable in the end, and was causing some crashes - but 4 did the trick.

Still seeking a workaround or fix for the gif issue.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: PNG and gif issues

Post by glennrp »

4 worked because it forced bit-depth 8. What's failing is the
reduction of opaque grayscale images to low bit depths. I'm temporarily
disabling that (SVN revision 3698, IM-6.6.7-9)
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: PNG and gif issues

Post by glennrp »

Writing grayscale images of 2 and 4 bit depths is working now: IM 6.6.8-6, SVN revision 3918.
Post Reply