Because JPEGs weren’t meant to. Sort of like asking why your Honda can’t float, it just wasn’t designed to.
JPEGs were meant for making photos small. It’s good at doing that, but photos taken from a camera don’t have, nor need transparency info, so it wasn’t included. JPEG’s algorithm compresses an image’s color using [YCbCr](https://i.pinimg.com/originals/43/6d/4b/436d4b5540810fa6492bd6fca4a42c09.jpg) instead of RGB, so adding a 4th transparency channel would make it less efficient.
If you want transparency, use another format such as .PNG.
Pixel data is usually encoded into a set of “channels”. Monochrome images have only one channel that represents the value of the pixels on a scale of black to white.
Color images have three channels: red, green, and blue which comprise the primary colors, and can represent any color when mixed.
The 4th channel is called the *alpha* channel and it represents transparency on a scale from invisible to totally opaque.
The JPEG image format simply does not have an alpha channel. It only has RGB color channels.
It can, actually. JPEG is just a codec. JPEG/EXIF and JPEG/JFIF are the file formats commonly used. There’s nothing stopping you from encoding an alpha channel and making a new JPEG/ file format. There isn’t a need to do so, so there isn’t a standard file format for it. Most use cases for transparency won’t work well with lossy images (blurred edges will be a big problem), so PNG or GIF is used instead.
And if you’re wondering, there is a new file format that does support alpha and is considerably better than JPEG: HEIF/HEIC
Because their encoding does not include transparency. Every digital image is made of grids of values, which describe the brightness for that point. In a greyscale image, all the values describe levels of brightness from black, through levels of grey, to white. Expanding on this, a colour image has three grids, one each for red, green and blue. In a .png there is a fourth grid, which allows levels of transparency. So in a way, asking why a .jpg can’t do transparency is similar to asking why a greyscale image can’t do colour. It could if it had a channel for it, but it doesn’t.
Each pixel in a JPG image has three data points.
RGB (Red, Green, Blue)
Each pixel in a PNG image has four data points
aRGB (Alpha, Red, Green Blue)
Each of those datapoints is called a channel, each channel can be set by a value of 0-255. Those values are then used to turn the pixel the correct color and or transparency. For instance…
R – 0
G – 255
B – 0
Would be full green on a JPEG
A – 175
R – 0
G – 255
B – 0
The above would be half way transparent and the color green.
All these answers suck to the core, with complete disrespect to the history of image formats.
JPEG came out in 1992 and was produced by digital cameras, so there’s no need for JPEG to support transparency. Computers support JPEG merely because people needed to view and edit their JPEG photos shot by the cameras. Then why nobody added transparency to JPEG format? Because shortly thereafter in 1995, the PNG image format was released and it supports transparency perfectly. So people who need transparency, just use PNG images. For transparent web graphics, people also extensively GIF images as it supports transparency.
The people who own JPEG format didn’t add transparency to JPEG until the year 2000 when they called the new format JPEG2000. So why don’t we have transparent JPEG after the year 2000? Because the JPEG2000 format costs money to use. Microsoft and Apple would have to pay big money to support JPEG2000, so really they just didn’t a damn. In the end, JPEG2000 lost the race, and PNG sticks to nowadays since PNG is patent-free.
Latest Answers