Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to tell the quality level of a JPEG?

This is really a two part question, since I don't fully understand how these things work just yet:

My situation: I'm writing a web app which lets the user upload an image. My app then resizes to something displayable (eg: 640x480-ish) and saves the file for use later.

My questions:

  1. Given an arbitrary JPEG file, is it possible to tell what the quality level is, so that I can use that same quality when saving the resized image?
  2. Does this even matter?? Should I be saving all the images at a decent level (eg: 75-80), regardless of the original quality?

I'm not so sure about this because, as I figure it: (let's take an extreme example), if someone had a 5 megapixel image saved at quality 0, it would be blocky as anything. Reducing the image size to 640x480, the blockiness would be smoothed out and barely less noticeable... until I saved it with quality 0 again...

On the other end of the spectrum, if there was an image which was 800x600 with q=0, resizing to 640x480 isn't going to change the fact that it looks like utter crap, so saving with q=80 would be redundant.

Am I even close?

I'm using GD2 library on PHP if that is of any use

like image 554
nickf Avatar asked Jan 08 '10 01:01

nickf


People also ask

How can you tell the quality of a JPEG?

To check a photo's resolution on a Windows PC, select the file you want to use. Right-click on the image and then select "Properties." A window will appear with the image's details. Go to the "Details" tab to see the image's dimensions and resolution.

What is JPEG quality level?

The amount of JPEG compression is typically measured as a percentage of the quality level. An image at 100% quality has (almost) no loss, and 1% quality is a very low quality image. In general, quality levels of 90% or higher are considered "high quality", 80%-90% is "medium quality", and 70%-80% is low quality.

How do you find the compression ratio of a JPG?

Right-click the image name and select "View layer metadata" in the drop-down. Click on Image properties to view the compression ratio.

Are JPEG files high quality?

JPEGs are designed to efficiently store high-quality digital photos packed with detail and color. They compress large images into much smaller file sizes, making them easier to share and upload online.


1 Answers

You can view compress level using the identify tool in ImageMagick. Download and installation instructions can be found at the official website.

After you install it, run the following command from the command line:

identify -format '%Q' yourimage.jpg 

This will return a value from 0 (low quality, small filesize) to 100 (high quality, large filesize).

Information source

like image 163
DuyLuc Avatar answered Sep 28 '22 07:09

DuyLuc