How to check JPG quality level (SOLVED)
August 5, 2022
This post is about how to find out the quality of a JPG image, as well as other image properties, such as the number of unique colors used in the file, image depth, and other detailed information about JPG and other formats.
How to know the quality of a JPG? Is it possible to determine the JPEG quality level?
When saving a JPG file using GIMP, you can adjust the quality with which the file is saved, values from 0 to 100 are available.
To view the quality of the IMAGE.jpg image, run the following command:
magick IMAGE.jpg -format '%Q' info:-
A number from 0 to 100 will be displayed indicating the quality of the image.
The magick command is part of the ImageMagick package. For details on installing ImageMagick, including which dependencies need to be installed to support the maximum number of formats, as well as a description of the command structure and all options, see the article: “ImageMagick guide: installing, using, and troubleshooting”.
What does JPEG quality level mean?
JPEG is a lossy format. Every time you save the same JPEG image, regardless of the quality level, the actual image quality is reduced. So even if you get the quality level from the file, you won't be able to keep the same quality when resaving the JPEG (even with quality=100).
You should save your JPEG as high quality as you can afford in terms of file size. Or use a lossless format like PNG.
Low quality JPEG files do not simply become more blocky. Instead color depth is reduced and the detail of sections of the image are removed. You can't rely on lower quality images being blocky and looking ok at smaller sizes.
According to the JFIF specification, the quality number (0-100) is not stored in the image header, although the horizontal and vertical pixel density is preserved.
The JPEG compression algorithm has some parameters that affect the quality of the resulting image.
One such parameter is the quantization tables, which determine how many bits will be used for each coefficient. Different programs use different quantization tables.
Some programs allow the user to set the quality level from 0 to 100. But there is no general definition for this number. An image made in Photoshop at 60% quality is 46 KB, while an image created in GIMP is only 26 KB.
The quantization tables also differ.
There are other options like subsampling, dct method etc.
So you can't describe them all by one quality level number, and you can't compare the quality of JPEG images by just one number, especially between files saved by different programs.
Compare the quality of an image with a size of 4000 × 2252 pixels saved at different quality levels.
Close up JPG with quality 92:
Close up JPG with quality 20:
Close up JPG with quality 10:
As you can see, even up to level 20 the quality is still not so bad, although at level 10 distortion is already strong.
In addition to the quality level, the quality of the image itself is also affected by its size in pixels. For example, the same image, but already saved with a resolution of 1000 × 563 pixels. This is a highly approximate image fragment similar to the previous ones:
As you can see, the quality of the transmitted small details was much more affected by the decrease in the number of pixels.
How to find out the number of unique colors in an image
To count the number of unique colors in the IMAGE.jpg image, use the command:
magick IMAGE.jpg -format '%k' info:-
Please note that all commands in this article can apply not only to JPG files, but also to other formats (if applicable):
How to find out the size of an image
To view the size of the image IMAGE.jpg in pixels, use the command:
magick IMAGE.jpg -format '%G' info:-
How to view image class and color space
To display the image class and its color space of IMAGE.jpg, use the command:
magick IMAGE.jpg -format '%r' info:-
How to view image depth
To display the color depth of the IMAGE.jpg image, use the command:
magick IMAGE.jpg -format '%z' info:-
How to view detailed image and color information
To display all available information about the IMAGE.jpg image, use the command:
magick IMAGE.jpg -verbose info:-
The examples above used the -format option, after which you can specify what kind of information you want to view. Adding the -verbose option causes almost all data to be shown, with the exception of some values that are calculated (rather than contained in the image data). For a complete list of available options for the -format option, see the following page: https://imagemagick.org/script/escape.php
Online service for displaying information about images
If you are a Windows user, or you don't want to install ImageMagick (or just delve into the command line), then you can use the following free service: View the JPG quality level (image compression rate): https://suip.biz/?act=show-image-compression-quality
This service will show the image quality level, number of unique colors, resolution and all other data that the previous commands shown in this article output.
- How to reduce image size. Bulk photo scaling and resizing on the command line (100%)
- How to convert a large number of images to another format (100%)
- The structure of the magick command (ImageMagick) (100%)
- ImageMagick guide: installing, using, and troubleshooting (83.9%)
- How to convert images to any formats in Linux (SOLVED) (71%)
- How to download YouTube videos on Windows and Linux (GUI without third party services) (RANDOM - 50%)