What would the web be with images? Within a few decades, the internet has gone from a digital dot matrix printer to a dynamic server of multimedia, including images, video, animations, and more. When it comes to digital stills though, there can be confusion over JPEG vs PNG, specifically when to use each one.
If you looked at a JPEG image alongside the same but as a PNG, you would likely see no difference. This is the ideal, as both image formats aim to reproduce the best image possible for the web. Though, there are different use cases and optimization techniques you need to be mindful of.
In this article, we’re going to compare JPEG vs PNG, and tell you when you should use each image format. First though, let’s introduce you to each file type.
On the surface (in a literal sense), there is no difference between JPEG and PNG. In other words, if we put two images up and asked you to choose which one was JPEG and which was PNG, you wouldn’t be able to tell most of the time. For example, take the following image:
Are you able to make a decision about whether this Scarlet Mormon butterfly is a JPEG or PNG image? Of course, without a frame of reference you can’t make a comparison:
There are definite differences, although it’s not going to make a huge deal of difference in this case. While you’re trying to decide (without peeking at your browser’s developer tools), there are some technical details we can share:
It seems clear cut – PNGs suit the web, and JPEGs don’t. Well, this isn’t the full story. Each file type is great for certain applications. Next, we’ll discuss them.
The web gets the best out of both JPEGs and PNGs. In fact, they dovetail in a nice way without much cross-over. As a handy soundbite, here is when you should use JPEG vs PNG:
If you want to display a photograph, use JPEG. For any other file – especially digital graphics – use PNG.
Though, this advice isn’t true for every situation (although it’s relevant for almost every case). For example, if you combine digital drawings with stock images, both JPEG and PNG will technically be incorrect to use. Later on, you’ll have more knowledge to make a right decision, although there are some other pointers to give you.
For example, if you envisage copying images, use a different file format than JPEG. This is because lossy compression formats only reconstruct an approximate version of the file. In contrast, PNG is a 1:1 reproduction because it offers lossless compression.
Also, if you want to resize your image once you save it, use JPEG as this handles scaling well. PNGs use a different encoding structure, which degrades once you change the dimensions (or other technical attributes).
Of course, JPEG vs PNG isn’t the only image file format comparison to consider. There are lots of other file types that compete for attention, and have other use cases:
While each of these image files will see use on the web (with the exception of RAW files with regard to display), JPEG vs PNG still dominates. They both have specific use cases for which the pros and cons balance well.
Despite JPEG vs PNG coming out as a draw with regards to final display quality, you have to handle each format in a different way to get the best out of it. There are three areas you can affect the file size, quality, and overall preparation of your images:
As you’d expect, there’s a fine balance here. Let’s begin with the dimensions of your image.
The dimensions of an image are more important for the end user than any other point in the chain. This is because the browser has to load the image, and a large file will erode the User Experience (UX). Though, this isn’t the only consideration. Of course, quality is key too. If you decide to make an image tiny in size, it’s going to affect the final image quality (more so for JPEGs than PNGs).
The answer is to hit the sweet spot across a few areas, starting with your image dimensions. As a broad rule, you want to make your images large enough so they can convey the details you need. There’s a point of overkill somewhere that’s different depending on the target platform and the image itself.
Modern crop sensor and full-frame digital cameras can produce images with default dimensions of around 6,000px x 3,000px (although there are wild differences between cameras). In contrast, images with the ‘long edge’ at around 2,000 pixels are common on social media. Bear in mind that this is for display at the full viewport of a device.
For blog images, this 2,000 pixel rule of thumb could even be as low as 1,000 pixels. This also takes into account high-definition or ‘Retina’ images. They often need double the dimensions to display as sharp on high-definition screens. In fact, the resolution is a good place to head to next.
One of the basic elements of digital screens is pixels. These tiny dots make up the entire display, although pixels aren’t a uniform size. Because of this, we also have to consider resolution when preparing our JPEG and PNG images.
We use Pixels Per Inch (PPI) to discuss how many pixels can fit onto a screen. You can also express this in centimeters, or as ‘dots’. The latter is for physical print formats, and graphic design circles use DPI often. As such, you’ll hear it used in an interchangeable way, although PPI is the correct term.
While the PNG image specification uses 72 PPI as its optimal design resolution, this wouldn’t take modern high-definition screens into account. While you could double the dimensions of an image in order to render it sharp on all screens, you can also do the same with the resolution too. For example, take this screenshot of the macOS Big Sur desktop:
It’s a PNG, with 1,000 pixels on the long edge (the top and bottom in this case). Though, it uses 144 PPI – although there’s some upload ‘magic’ that converts the resolution to 72 PPI on upload to WordPress.
Both PNG and JPEG images can use much higher PPIs too – print-ready resolutions are around 300 DPI/PPI. What’s more, lots of images from stock photo sites such as Pixabay will download using 300 PPI:
As such, reducing this will better prepare your images for the web and its various displays.
We don’t have to tell you much about image optimization. It’s a topic you can find elsewhere on the blog, and almost all WordPress users will know to optimize images either before or during the upload process.
The general concept is that you apply extra compression to images, often in a lossy way. This does affect image quality, and it’s noticeable if you make sweeping changes to the dimensions and resolution before applying heavy lossy compression.
These artifacts have to be minimal in order to present images well. Because of this, there are lots of tools available to do the job. The most accessible is TinyPNG, although it also compresses JPEGs too:
Though, the compression it applies is gentle on some images, which might not bring the file size down enough. A service such as ShortPixel has an aggressive lossy compression format available, while its Glossy compression does an admirable job compared to TinyPNG.
The takeaway here is that you have to balance the level of compression with both the file size, and all of the other elements of the image. In the next section, we’ll discuss the best approach to take.
Despite the differences in file formats, the nature of browsing the web means you can boil down preparing your images to the following:
There’s a little more here based on specific file formats:
By now, you should have a solid grasp on JPEG vs PNG, when to use them, and how to prepare you files; and if you still want to know which image was JPEG from the beginning of the article, it’s the first one!
It seems as though images run the web. Because of this, we have a number of file formats to help us deliver the right quality at a respectable file size for the application. JPEG vs PNG is a common comparison because it’s not clear what either are good at, and they are two popular image formats.
In short, JPEGs are for photos, and PNGs are for graphics. To prepare your files, the main concern should be keeping image quality high rather than file size. Still, while adjustments to the resolution give you the biggest changes, this has more of an impact on the image quality. The trick is to balance dimensions, resolution, and compression to achieve the ultimate web-ready image.
Do you prepare you images for web as we’ve outlined here, or do you do something different? Let us know in the comments section below!
Trying to figure out how to start an online course so that you can share…
Considering using LearnDash to create online course content with WordPress? LearnDash is a popular WordPress…
WordPress XML files see a lot of use for me as a content creator, and…
If you’re looking for a way to deliver an online course, complete with all the…
Search Engine Optimization (SEO) is crucial for any website that wants to maximize its traffic…
Kinsta is a notable brand in the WordPress hosting space. The standout aspect of the…