The title of this post says everything.
JPGs Can’t Handle Transparency, So Use A PNG Instead
Earlier today I got lost in the details while using The GIMP to create a couple icons for a new WordPress theme. I kept seeing this colored background for an icon that I knew just wasn’t there. I could see that the image had only one layer and no background layer in the layers dialog of The GIMP, but every time I saved the image and viewed the result in my browser I saw the colored background.
This drove me mad until I spotted the obvious mistake. I had been saving the file that I wanted to have a transparent background as a jpg file. Since jpg files can’t handle transparency The GIMP tries to accommodate by exporting the file as a .jpg. Unfortunately, the current background color is used to fill in the transparent parts of the image, so you end up with a non-transparent image.
To make a transparent image or an image with a transparent background, save the file as a png file. PNG files can handle transparency, so once I saved my image as a .png the colored background went away.
One caveat here is that image files with the extension .png are not recognized by older browsers so the colored background will show through and the image won’t be transparent.
4 thoughts on “JPGs Can’t Handle Transparency, So Save As PNG Instead”
Hey I’ve been saving my transparent images on GIMP as PNG formats but I still get a white background. I’ve done as much as I could think of: adding the alpha channel to the image, adding layers, and even unchecking and rechecking boxes whenever I save it. Can you tell me what is wrong and how I can fix it? Thanks.
Sometimes you can work around a stubborn issue with brute force. Not sure why you’re not getting the transparency, but you could try to copy the image by selecting everything, Ctrl-C, opening new image and assure that it is transparent to start with, then paste into it. Kinda messy with several layers, but it might work.
Top of the afternoon to ya, Mate! So glad me post helped ya figure things out.
Have a great day, Arrrgh!
FINALLY!! It worked! I’ve been banging my head against the wall since I started this site trying to figure out how to do this. Don’t know why I didn’t type my question into bing sooner. Yours was the first answer to come up and it was so simple to do. Huge thanks for posting that! It was a real big help.