Transparency...

images php coding issues or problems here.

Moderators: egami, macek, 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:

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)
11:16am up 404 days, 2 users, load average: 148.68, 143.45, 132.6


Mike Vassileiou
[Systems Administrator / PHP Developer]


PHP/MySQL Manual:
http://www.phpmysql-manual.com

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

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
avatar image based upon nasas apod (only updates if I post though)

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

Sat May 31, 2003 2:04 am

note: a few comments in the online manual state that transparency only works for black
avatar image based upon nasas apod (only updates if I post though)

Post Reply