Does everything make sense.jpg to convert to png?

Read about the advantage of the .png format over.jpg. And yet, the latter is still widely used. Why is that?

As far as I understand, for technical reasons unknown to me, cameras can not save images in the .png format, but even if this is the case, why do modern cameras not convert the captured .jpg to .png, since the latter is better?

Finally, does it make sense for your sites and apps to convert all .jpg images to .png?

Author: Боков Глеб, 2017-09-27

2 answers

These formats have different purposes. JPEG is great for photos, because the losses that occur during encoding are almost invisible in the photo. The thing is that there are no very sharp transitions between neighboring pixels in the photo, and the JPEG algorithm exploits this property. PNG has lossless compression, its algorithms do not cope well with photos, and work perfectly on artificially generated images, like text, some graphs, diagrams, or just a screenshot. pages similar to stackoverflow.

No need to blindly convert everything to PNG. The best approach is photo / photo-like large images in JPEG, simple or small-in PNG.

Why cameras use JPEG. The encoding speed in JPEG takes some time, which depends only on the size of the image. With PNG, it is more difficult, because for better encoding, the algorithm tries different algorithms. The camera has limited computing resources, and JPEG encoding is easier to implement at the level of the microprocessor. This will allow you to take more pictures per unit of time. Secondly, it makes no sense for cameras to take photos in PNG without loss. If you look at an enlarged photo from any digital camera (even a lossless compressed one) you will see small interference at the level of neighboring pixels. JPEG encoding still slightly distorts neighboring pixels, but it has almost no effect on the final quality. Third, a PNG photo will take up several times more space and this used to be a problem.

 6
Author: Zergatul, 2017-09-27 00:42:33

We take a typical photo from here. Save it. Convert to PNG:

convert 500px-Lamborghini.jpg 500px-Lamborghini.png

We look at the dimensions:

$ du -sh 500px-Lamborghini.*
32K     500px-Lamborghini.jpg
136K    500px-Lamborghini.png

Total: the transition to PNG resulted in a four-fold increase in the size of a typical photo. If that's your goal, then yes-switching to PNG makes sense. Otherwise, not really. It is better to leave the photo in its original format.

 0
Author: sanmai, 2017-09-27 07:53:48