Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why should I use PNG and not JPG? [duplicate]

I'm building an app that uses a lot of images, so it's getting pretty big. I got more than 15mb in PNG images, and if I convert those images to JPG I would get 5MB or less! So, why should I use PNG instead of JPG?

I know that PNGs are preferred, but what would I lose with JPG?

EDIT: Thank you everybody!

Just a note: Since I got my answer and turns out that I will need to use PNG in most files, I found out that website http://tinypng.org/ , and that's helping me a lot. My 15mb of images are now 7mb. So, if anyone is in the same situation that I am, I hope that it helps!

like image 226
Victor Santiago Avatar asked Oct 18 '12 03:10

Victor Santiago


People also ask

Why are PNGs better than JPEGs?

The biggest advantage of PNG over JPEG is that the compression is lossless, meaning there is no loss in quality each time it is opened and saved again. PNG also handles detailed, high-contrast images well.

Is it better to have PNG or JPG?

PNG is a high-quality graphics format – generally higher in quality than JPEGs, which are compressed to save space. The PNG format uses lossless compression and is generally considered a replacement to the Graphics Interchange Format (GIF format).

Why is a PNG a good file to use?

PNG format is a lossless compression file format, which makes it a common choice for use on the Web. PNG is a good choice for storing line drawings, text, and iconic graphics at a small file size. JPG format is a lossy compressed file format. This makes it useful for storing photographs at a smaller size than a BMP.


2 Answers

Major reason - PNG will give you advantage of Alpha Transparency over JPG.

Also see: PNG vs. GIF vs. JPEG vs. SVG - When best to use?

like image 91
Parag Meshram Avatar answered Sep 27 '22 22:09

Parag Meshram


PNGs are smaller for images a few solid colors (solid polygons) (because they make JPEG artifacts more obvious) JPEGs are better for photos and other images that don't have consistent patterns (JPEG artifacts are harder to notice here)

like image 34
Hayk Saakian Avatar answered Sep 27 '22 21:09

Hayk Saakian