What's The Difference Between JPEG And PNG?
There are a lot of digital image file formats out there, but JPEG and PNG are two of the most well known. You'll find them everywhere — on websites, in apps, tucked away in game files, and more — although some sites automatically convert them to WEBP, which has become quite common these days.
JPEGs are often the default when taking photos, and if not you usually can change that — like when your iPhone is set to HEIC — while PNGs are more of an opt-in choice. But despite their ubiquitousness and common bond of "being used for images," the two formats are a fair bit different from one another. Kind of.
Like many digital image file formats they're somewhat interchangeable to a point. Each has its benefits and drawbacks based on what you're using them for, of course, but if you're in a hurry or otherwise don't have a preference, there's no rule that says you have to pick one over the other. At least until you try to upload an image that requires one or doesn't support the other.
Joint Photographic Experts Group
JPEGs (also often called JPGs) are one of the most common file types used for digital images. They strike enough of a balance between file size (compression), quality (24-bit), and color (up to 16 million) to be a viable option in most digital photo viewing situations on both computers and smartphones.
This means that JPEGs are almost always supported in most places — from web pages to remote check deposits. In addition to working with almost anything (even a lot of older hardware), their compression and generally smaller file size makes them easier to store, faster to transfer, and fairly quick to edit.
That somewhat universal usefulness does come at a cost, though. While JPEGs get the job done for web pages, emails, etc., they aren't usually ideal for output at higher resolutions. Things like high quality photos and printed materials benefit more from being saved in a format like TIFF.
Portable Network Graphics
PNGs are a bit more nuanced than JPEGs despite sharing a similar 16-million color limit. The format is very common for websites, but since it's "lossless" you're looking at files that often take up more space.
It's also a very common file type for digital graphics (as opposed to photos) used in illustrations, logos, and various forms of web design because of one very particular advantage: Transparent backgrounds. They're not your only choice if you want to avoid backgrounds in your digital images — GIFs also allow for this — but they are the better option if you want to retain higher resolutions.
Transparencies are why you'll see company logos placed over complex backgrounds or other images without any awkward borders or framing, and they are why web interfaces are able to layer on top of other graphical elements. That lack of image compression is usually why the graphs you'll see online tend to look so clean and sharp.
Which one do you choose?
While JPEGs are possibly the most common digital image file type in the modern era, PNGs are also supported just about everywhere. There's really no blatantly right or wrong choice between the two much of the time; however, they both have their advantages under specific circumstances, so it's more a matter of efficiency.
You can use either for a photograph, but if you're worried about file sizes, the compression you get with a JPEG is your friend. On the other hand, if you want the image to be as clear as possible, PNG is the better one to go with. Similarly, if you have some high-resolution imagery like a chart or graph that you want to transfer to a smaller screen, switching to a smaller JPEG file format and size should be no problem.
Really, the biggest deciding factor comes down to background transparencies. If your image needs to have a transparent background, JPEG is simply not a viable option because it doesn't support them at all. So, you'll either need to go with PNG, or try using GIF if the compression isn't too much of an issue.