Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Only PNG supports transparency, is that true?

I found JPG does not support transparency, the alpha value is always 255. I am wondering only png supports transparency?

like image 612
Adam Lee Avatar asked Feb 05 '12 08:02

Adam Lee


People also ask

Does PNG or JPEG support transparency?

JPEGs don't support transparent backgrounds. Non-rectangular logos and graphics featuring lots of text are unlikely to work well in this format as a result. JPEG images will also struggle to blend seamlessly with web pages that feature different background colors. PNG files, on the other hand, do support transparency.

Can a JPG have transparency?

The JPEG format doesn't support transparency. But we can create our own transparency using a second image as an alpha channel.


2 Answers

  • png-32 supports different levels of transparency. Each pixel can have an opacity between 0 and 255, with 0 as completely transparent.

  • png-24 supports setting one color as fully transparent. Everything else will be opaque.

  • gif uses a color palette. You can specify that one color in the palette is fully transparent.

  • png-8 also uses a color palette but each color in the palette has its own opacity value, so it supports varying levels of transparency too.

  • jpg does not support transparency.

like image 72
Richard G. Nielsen Avatar answered Sep 18 '22 00:09

Richard G. Nielsen


JPEG 2000 supports full transparency. See JPEG 2000 Side channel spatial information.

like image 25
Neil Steiner Avatar answered Sep 20 '22 00:09

Neil Steiner