2008/08/14

PNG8 opacity color doesn't display in Firefox 2, 3

When a PNG8 file has a color that is identical to its opacity color, 
some software ( like Firefox 2 or 3 ) will not display this color.

The probability of this bug is 1/255*255*255*255
because each channel( R, G, B and alpha ) has 8 bits long.

In ImageMagick or GraphicsMagick,
the opacity color can be deleted with matte(false) function,like



/* g++ `pkg-config --libs --cflags ImageMagick++`cut_sasebo.cpp */
/* export LD_LIBRARY_PATH=/usr/local/lib */
#include
#include
using namespace std;
using namespace Magick;

int main()
{
Magick::Image image("sasebo_big.png") ;

image.crop( Magick::Geometry(256, 256,
1536, 2303));

image.matte(false);

image.quantizeColors(256);
image.quantizeDither(false);
image.quantize();
image.write("sasebo_256x256.png"); return 0;
}







Not that both ImageMagick and GraphicsMagick has left its PNG8 format unfnished.
The PNG8 format is not made by PNG group, but Adobe.
Technically, PNG8 is GIF format plus a opacity color.

if (LocaleCompare(image_info->magick,"PNG8") == 0)
{
(void) SetImageType(image,PaletteType);
if (image->matte)
{
/* To do: Reduce to binary transparency */
}
}


Ref:
http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=11406&p=38212 http://www.imagemagick.org/Usage/formats/#png http://www.graphicsmagick.org/www/Magick++/Image.html#Image%20Manipulation%20Methods

0 件のコメント: