how to make JPG image transparent background?

10,215

Solution 1

The provided example image is in fact not a JPEG, but a png file. It has the extension and mime-type of a jpeg file, but it's contents are in png format.

JPEG file format does not support transparacy.

So if you need transparancy in images for use in browsers. You can either:

  • convert the image to png, this works in all browsers
  • use ZorroSVG, requires SVG support but results in smaller files for photographic images.
  • use webp, only use when you have fallbacks in place for browsers that do not support webp.

Solution 2

The new JPEG-XR standard supports transparency.

However, this is not a real JPG, it's a PNG. If you rename it to .txt, you can see that the contents of the file start with PNG:

enter image description here

Share:
10,215
user2310894
Author by

user2310894

Updated on June 05, 2022

Comments