Transparency...

images php coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Post by mike » Thu May 29, 2003 2:21 pm

imagecolortransparent()

int imagecolortransparent ( resource image [, int color])


imagecolortransparent() sets the transparent color in the image image to color. image is the image identifier returned by imagecreate() and color is a color identifier returned by imagecolorallocate().
bla ... bla... (check on manual)

pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Post by pootergeist » Fri May 30, 2003 7:37 am

As a transparency has existed I would guess (yup, guess as I've not used transparencies on png [which should in most instancies use an alpha channel as opposed to index - though obviously IE cannot display alpha-transparency pngs and moz has a few snags still])

imagecolorallocate is attributing white to a second index, whereas you want the primary index to take the transparency - a workaround would be

$indx = imagecolorclosest($img, 255, 255, 255);
$white = ImageColorSet($img, $indx, 255, 255, 255); // resets that index to true white

using that rather than imagecolorallocate *should* work better theoretically - though you will obviously have problems due to basing your images creates on speckled-lossy jpegs which never have good colour holding ability

pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Post by pootergeist » Sat May 31, 2003 2:04 am

note: a few comments in the online manual state that transparency only works for black

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest