The simplest explanation is that compression level helps you balance image quality against image size. Usually, the highest-quality images have the largest file sizes, but compression allows you to shrink that file size down while maintaining quality – the trick is where you set it.
Compression level in GIMP appears when you’re exporting your finished work as one of the standard image file types like JPEG, PNG, or TIFF. Each one has a quality/compression setting that you can adjust for your needs, but they don’t all work the same way.
The “Compression level” setting when saving PNG files determines the final file size of your image and also affects how long it will take to save. The highest compression rate (0 is the lowest and 9 is the highest) will make the smallest file, but it will also take the longest to save.
My name is Thomas Boldt, and over the years I’ve saved more digital images than I can possibly count, from high-resolution fine art photos to lazily-edited dank memes. I’m usually very demanding when it comes to image quality, but sometimes you have to make sacrifices to save a few extra KBs, and I’ll help you figure out how to get the best image you can with GIMP.
We’ll take a look at compression level settings for common image file types and discuss which options are best for different situations, whether you’re trying to save images for a website at the smallest possible file size or to make sure that your photographic masterpieces look their best.
GIMP Compression Levels Made Simple
Compression allows you to reduce the file size of your image. A high-resolution photo from a DSLR camera can be upwards of 75 megabytes in size, but the same file compressed into the JPEG format at 100% quality can shrink down to under 20 megabytes.
The same general idea applies to all types of image compression, but they’re not all created equal. Three of the most popular digital image formats are JPEG, PNG, and TIFF, and they each use compression in different ways.
Files saved in the JPEG format use a technique known as “lossy” compression, which means the algorithm discards some image data to reduce your file size. JPEGs are often the best compromise between file size and image quality, and they’re the most popular image format.
PNG uses a “lossless” compression method, so increasing the compression does NOT reduce your image quality. Instead, increasing the compression level simply means the computer will try harder and longer to get the file size as small as possible.
TIFF can also optionally use compression. LZW and Deflate both provide lossless compression, while JPEG provides lossy compression as usual. PackBits compression is only effective on black and white images, and can actually increase the file size of more complex color images.
What Compression Level Should I Use?
The best compression level will depend on two things: the content of your image, and any file requirements you have. If you need to use transparency in your image, you’ll have to choose PNG, but if you want your image accessible to the widest audience then JPEG is your best bet.
TIFF files are most commonly used by imaging professionals who demand exceptionally precise image quality, thanks to the ability to store complex bit depths without degradation. If you need the absolute best in image preservation, TIFF is the best choice – but the files get quite large.
JPEG Compression Levels
If your image is a photo, you’ll want to compare a few different settings to find out what looks best. Large areas of similar color can compress quite well without noticeably losing image quality, often reducing your file size by 50% or more.
To see the effects of your compression adjustments in the GIMP workspace, simply check the Show preview in image window box. The Export dialog box will also update with an estimated file size for your chosen settings.
Setting this photo to be saved at 20% JPG quality seriously degrades the image quality, creating color banding across the image, especially noticeable in the lighting in the clouds and color shifts in the foreground trees. If we go any lower, the subjects get almost unrecognizable.
All that sounds bad until you see that the file size has dropped from 2.0 MB to 97.8 KB, over 20 times smaller than at 100% JPG quality. At this setting the image is too overcompressed to use for much of anything, but it shows how important it is to set the right compression level.
Usually, a quality setting between 70-85 is ideal – you get some of the benefits of a smaller file size, without having to lose much image quality. If you’re not saving a photo, you can often get away with setting the quality down to 25 or 30 – always test your options!
This is especially important when it comes to saving images for the web. Search engines consider how quickly your page loads when determining ranking position, so make sure you trim those files down as much as possible without compromising (too much) on quality.
PNG Compression Levels
PNG compression is actually quite a lot simpler than JPEG because you don’t have to worry about losing any image quality. Everything is lossless, and you get the option of including transparent sections in your image. The tradeoff comes in the form of larger final file sizes.
Technically, it takes longer to save a PNG at the maximum compression level (remember, 0 is lowest and 9 is highest), but on modern computers, it’s not usually a noticeable delay, so feel free to use the maximum by default.
Exactly how the different compression levels work is a bit beyond the scope of this article (and to be honest, a bit beyond my very limited grasp of mathematics and information theory), but you can read about them here on Wikipedia if you’re curious.
TIFF Compression Levels
TIFF files are usually the largest of the three by a significant margin. A 3 megabyte JPEG file unchanged but re-saved as a TIFF expands up to a whopping 17 MB with no compression, and more than doubles in size to nearly 7 MB when using the LZW lossless compression option.
The ‘Deflate’ option is actually a very similar compression algorithm to that used by PNG, also known as ZIP compression in some programs. It performed best during my testing, but only marginally better than LZW, creating a file about 6 MB in size.
For the widest possible compatibility, LZW compression is usually your best bet as it has been around longer than ZIP compression, but it’s extremely rare to run into TIFF compatibility issues with modern software. If storage or transfer speed is important, ZIP makes the smallest files.
A Final Word
Hopefully, that’s answered all your questions about compression levels in GIMP. Each and every image has unique needs, and now you know everything you need in order to save your masterpieces in all the glory they deserve – even if it’s just a meme =)About Thomas Boldt