Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alpha transparency in indexed-png images

Here is an image: Gradient1
This image is a simple black-to-transparent gradient saved in full RGBA PNG.

Here is the same image, converted to indexed-alpha PNG by GIMP (Photoshop produces the same result)
Gradient2
As you can see, the gradient is now half-opaque, half-transparent.

Here is the same image again, only this time it was converted to indexed-alpha PNG by a PHP script I wrote:
Gradient3

So my question is: Why are GIMP and Photoshop unable to support partial transparency in indexed images, when the PHP script clearly shows that such an image can be created with no problems?
Is there anything "wrong" with an image whose pallette contains alpha information?
A more programming-related question: Does this transparency in the last image work in Internet Explorer 6?

like image 264
Niet the Dark Absol Avatar asked Nov 15 '10 11:11

Niet the Dark Absol


1 Answers

I've finally found the actual answer: There is a metadata entry that allows you to define the alpha value of each colour in the colour table. Most graphics programs don't make use of this, but it does exist and can be used, in particular by GD.

like image 149
Niet the Dark Absol Avatar answered Oct 11 '22 16:10

Niet the Dark Absol