Question

I have a png image, which you can see here:

http://img10.imageshack.us/img10/9145/archer5.png

The background of the sprite is transparent, I see this on all my browsers and in infranview (which I used to create this), and gimp and windows explorer.

However in Photoshop, Paint, and most importantly PHP GD there is a solid background. Check out the image with one of those applications to see what I'm talking about.

The thumbnails produced on my server are all solid background, not good.

What can I do to make the transparency be recognized by all applications?

Thanks.

Note: I also have 2000 of these images that needs to undergo the same operation. Any batch suggestion would be great as well.

Edit: Sorry guys I apologize for my ineptness! WRONG FILE! I updated the link with the correct file, sorry!

Was it helpful?

Solution

It's transparent for me too.

MS Paint doesn't support transparency

As you mention PHP GD check this links

Preserve PNG image transparency

Resize and Compose Transparent PNG with PHP

imagecolortransparent PHP Manual

imagealphablending PHP Manual

imagesavealpha PHP Manual

OTHER TIPS

It has a transparent background in Photoshop for me. I'm guessing that if it isn't transparent in some application, it is a problem with the application (not supporting transparency) than with the file.

I think your problem is the applications themselves. When you say PHP GD I think what you really mean is "Internet Explorer" (since PHP is not a viewer). Internet Explorer (at least up to IE7) doesn't do transparent PNG (it puts a grey image behind) unless you do some quirky bullshit with an Alpha filter.

This is your (updated) image in safari (which supports PNG correctly): alt text
(source: arc.net.au)

GD requires one of various options (either directly or in the image type when you create a new image) in order to output transparent pixels.

Perhaps you could try saving them as 24-bit PNGs, instead of 32-bit. Maybe PHP GD would have better support for that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top