There are some fundamental differences between jpg and png files that you should be aware of. Both file formats have their own purposes.
Adobe Stock
When it comes to digital images, two file formats rise above the rest: jpg and png files.
The same image may superficially look the same in both jpg and png formats. They still have significant differences in features and intended use.
Jpg
Jpg, or Joint Photographic Experts Group, is now somewhat of a standard in digital photography and image distribution online.
A jpg image is compressed using a discrete cosine transform. Pixels that are similar enough are combined into blocks whose pixels have the same value. This reduces its file size – but also the image quality.
During compression, information is lost from the jpg file, which can no longer be restored later. If the jpg file is edited, its quality will suffer with each save.
Especially the small details are in the jpg image on the line of fire. The text in the picture messed up by jpg artifacts looks very ugly and unprofessional. Jpg also doesn’t support transparency, so you can’t create anything other than square graphics on the internet.
Attempts have also been made to develop lossless versions of jpg. One of them is the heic file format used in Apple products, which, however, at least for now, is hardly supported elsewhere. Jpg-ls, jpg 2000 and bpg, on the other hand, did not really gain popularity.
In general, the jpg format is optimized specifically for photos where its compression artifacts are not too visible to the human eye. On the other hand, in line graphics and flat color surfaces, its packaging artifacts are easily visible.
In summary, it can be said that jpg is suitable for use when the image does not contain smooth color surfaces, text or sharp borders, or if the image in png format is too large in file size to be usable.
Png
Png, or Portable Network Graphics, is a lossless file format, i.e., unlike jpg, it preserves the appearance of the image with pixel accuracy. This is possible with Lempel-Ziv-Welch compression.
Most often, png is the default file format for screenshots taken on computers and smart devices.
Unlike jpg, a png file can also contain transparent parts. This allows for things like rounded corners, showing content visible on the lower layer below the png file, and so on.
Since png is lossless, you could imagine that it would be great for photography instead of actual raw files. However, the truth is that there are better alternatives available, for example Adobe’s Digital Negative and the tiff file format.
Png also does not store the metadata of the image, so it is not clear when or with which camera it was taken.
There is also an alternative format of png, apng, in which you can also save animations. It is relatively well supported on the internet today, but so far it has not replaced the older gif file format, which also enables animations.
Due to the factors mentioned above, png is well suited online for e.g. drawings, graphics, logos and icons. It is also a good idea to save images that show different computer programs, applications and user interfaces in png format, especially if it is likely that they will need to be edited later, for example by adding notes.
One of the biggest negatives of png is that the image file size increases the more details it contains. A graphic consisting of flat color surfaces may still be a file of human size, but for complex images and especially photos, the size of png files is quickly astronomical compared to lossy image files.