views:

310

answers:

3

I would like to make a JPEG image file with some pixels that are partially transparent or fully transparent, similar to a PNG file with an alpha channel. Is this possible? If so, how would I go about doing this?

I would like to use the image on a website. If I try to do this, would it work in any or all of the popular browsers (IE 7+, Firefox, Safari)? Assuming it is possible, will it just work, or are there any tricks or hacks required to make it work?

EDIT: Some of the replies say I can't do this. However, I found this page describing a JPEG image with transparency. Does anyone know if there is a convenient way to produce files in this format? Is it widely supported?

+5  A: 

JPEG doesn't support transparency. You'll need to stick to PNG or GIF. Why do you want to use a JPEG for transparency?

DavGarcia
I would like to use a complex image, with lots of smooth gradients, like a photograph, and let my background show through part of it, but I would like the file to be smaller than a PNG.
mikez302
I see. Definitely will have to go with a PNG then and accept the file size. There are many ways to improve PNG sizes, check out this article that helped me: http://www.smashingmagazine.com/2009/07/15/clever-png-optimization-techniques/
DavGarcia
+1  A: 

The JPEG format doesn't provide for an alpha channel. You can make a PNG file, however. It will work in IE7+ and other "modern" browsers.

Pointy
+3  A: 

You cannot have any kind of transparency with a JPEG image : JPEG doesn't support that.

You'll have to switch to PNG images, to get either 1bit or 8bits of transparency (or GIF, which only supports 1 bit -- i.e. transparent, or not-transparent)

Pascal MARTIN