Jump to content

Php GD, more than 1 transparent color?


Michdd

Recommended Posts

That is because transparency is created by defining only one color value as transparent.  Partial transparency is available in PNG, using Alpha channels, however an image with an alpha channel is a completely different beast. 

 

Alpha channels involve the combination of a per pixel Alpha blending value.  So the first thing you need to know is that alpha channels in the png spec only work with png images that use 8 or 16 bit color.    Rather than specify a color that should be rendered transparent, an alpha channel acts as a mask value on a per pixel basis, indicating what opacity the pixel should have.  This is simplifying the question a bit, because png's using an index table, can also specify an alpha value for a particular color in the color table index, which is probably the closest thing to what you originally inquired about.

 

There's an example of merging images to create a watermark effect in the php manual that touches upon some of this material:

 

http://us.php.net/manual/en/image.examples.merged-watermark.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.