Possible bug writing small .gif images

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
odrm
Posts: 1
Joined: 2011-04-04T06:57:02-07:00
Authentication code: 8675308

Possible bug writing small .gif images

Post by odrm »

Code: Select all

$ convert -version
Version: ImageMagick 6.6.9-1 2011-04-04 Q8 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP OpenCL  
Small images with a transparent background are incorrectly saved with a black background. To reproduce:

Code: Select all

$ convert -size 16x16 xc:none -fill blue -draw 'rectangle 4,4 8,8' s.gif
$ identify -verbose s.gif
...
  Histogram:
       230: (  0,  0,  0,255) #000000 black
         1: (  0,  0,  0,  0) #00000000 none
        25: (  0,  0,255,255) #0000FF blue
...
The transparency wasn't saved, but was replaced with black. For a larger image, this doesn't appear to happen:

Code: Select all

$ convert -size 32x32 xc:none -fill blue -draw 'rectangle 4,4 8,8' m.gif
$ identify -verbose m.gif
...
  Histogram:
       999: (  0,  0,  0,  0) #00000000 none
        25: (  0,  0,255,255) #0000FF blue
...
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Possible bug writing small .gif images

Post by magick »

We'll add a patch to fix this problem to the next point release of ImageMagick. Thanks.
sas
Posts: 44
Joined: 2009-11-28T16:35:46-07:00
Authentication code: 8675309

Re: Possible bug writing small .gif images

Post by sas »

I might be hitting the same bug (also using ImageMagick 6.6.9-1).

In my case it doesn't replace transparent pixels with black, however, but rather with the "Alpha" background color saved with the image:

bullet.png Image

Code: Select all

$  identify -verbose bullet.png | grep "Alpha: "
  Alpha: rgba(255,0,0,0)   #FF000000

Code: Select all

$  convert bullet.png bullet.gif
--> bullet.gif: Image (Also note the top-left pixel being set to grey)

Code: Select all

$  identify -verbose bullet.gif | grep "Alpha: "
  Alpha: none   #00000000
This happens to me for images of size 10 x 25px or smaller, but not with larges ones.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible bug writing small .gif images

Post by fmw42 »

The following works fine for me under IM 6.6.9.4 Q16 Mac OSX Tiger.



convert -size 16x16 xc:none -fill blue -draw 'rectangle 4,4 8,8' tmp.gif

identify -verbose tmp.gif

Code: Select all

Format: GIF (CompuServe graphics interchange format)
  Class: PseudoClass
  Geometry: 16x16+0+0
  Resolution: 72x72
  Print size: 0.222222x0.222222
  Units: Undefined
  Type: PaletteMatte
  Endianess: Undefined
  Colorspace: RGB
  Depth: 8/1-bit
...
  Histogram:
       231: (  0,  0,  0,  0) #00000000 none
        25: (  0,  0,255,255) #0000FF blue
  Colormap: 2
         0: (  0,  0,255,255) #0000FF blue
         1: (  0,  0,  0,  0) #00000000 none
sas
Posts: 44
Joined: 2009-11-28T16:35:46-07:00
Authentication code: 8675309

Re: Possible bug writing small .gif images

Post by sas »

After upgrading to ImageMagick 6.6.9-4 2011-04-11 Q16, it works as expected now. Great!
fmw42 wrote:convert -size 16x16 xc:none -fill blue -draw 'rectangle 4,4 8,8' tmp.gif
That probably always worked, the problem was only with images with width ≤10px and height ≤ 25px (at least for me).
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Possible bug writing small .gif images

Post by anthony »

Small GIF files with transparency is still broken!!!!

Code: Select all

   convert -size 9x9 xc:none png: | convert - -scale 1000% show:
will show a transparent image which is what I asked for.

Code: Select all

   convert -size 9x9 xc:none gif: | convert - -scale 1000% show:
shows an all black image but for a single transparent pixel in the top-left
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Possible bug writing small .gif images

Post by anthony »

This is still broken!!!!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible bug writing small .gif images

Post by fmw42 »

anthony wrote:This is still broken!!!!
see also viewtopic.php?f=1&t=21583
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Possible bug writing small .gif images

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.7.8-9 Beta. Thanks.
Post Reply