On Fri, 19 Dec 2008 10:40:31 -0500
[email protected] wrote:

| On Fri, 19 Dec 2008 23:09:27 +0800
| "Jinsong Zhao" <[email protected]> wrote:
| 
| >Hi there,
| >
| >I hope to convert powerlogo.gif
| >(http://www.freebsd.org/gifs/) from gif format to png
| >format. However, the transparency in gif figure lost.
| >
| >I just used:
| > convert powerlogo.gif powerlogo.png
| >
 
I have been experimenting and you are right about the PNG not containing
the correct transparency.

  display  powerlogo.gif

shows the image to have transparency.

  convert powerlogo.gif -alpha extract mask.gif

even shows the image to contain transparency!

But a write to PNG seems to ignore the transparency in the image

  convert powerlogo.gif powerlogo.png

Outputting just a single pixel crop does NOT fix the problem so this
may provide a good way of tracking the problem (one pixel involved)

  convert powerlogo.gif -crop 1x1+1+1 powerlogo.png
  convert powerlogo.png txt:-

  # ImageMagick pixel enumeration: 1,1,255,rgb
  0,0: (190,190,190)  #BEBEBE  grey


Note that GIF does declares the transparent color (in its color palette)
to be a gray '#BEBEBE' color (normal behaviour) so that is the source
of the gray color.  The color itself is not mysterious.

The reason "-transparent black" works is that the image is 'processed'
so that whatever is causing the problem is cleared.  But that does not
help us fix the bug.

Something is VERY wrong with the GIF image once it is in memory that
causes PNG to not see the images ALPHA channel correctly.

Hmmm the image in memory will be a 'palette' image until something
needs to process the images color directly (crop does not need to)
so it may be something about PNG handling a 'palette' image type

For example forcing IM to store the image in a 'direct' color style
fixes the problem, saving the image correctly without modification,
and with transparency.

  convert -type TrueColorMatte powerlogo.gif powerlogo.png

As such I would say it is a problem with palette handling by the PNG
coder.

Cristy, can you please look at this.

  Anthony Thyssen ( System Programmer )    <[email protected]>
 -----------------------------------------------------------------------------
   The Internet is like a herd of performing elephants with diarrhoea --
   massive, difficult to redirect, awe-inspiring, entertaining, and a source
   of mind-boggling amounts of excrement when you least expect it.
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to