Sign in to follow this  
Followers 0
mlowery

[RESOLVED] How to read JPG quality from saved image?

5 posts in this topic

#1 ·  Posted (edited)

I've inherited the family digital photo album of JPG photos. There are tons of dupes saved at varying sizes and JPG compressions. I'd like to write a quick script to group the images by size and JPG quality so I can review and purge them more easily.

I can get the dimensions of an image through the GDI+ UDF. How can I read the JPG compression / quality from the saved image? (EXIF data is no help; whatever editing tool was used to resize the files wiped it out.)

Edited by mlowery

Share this post


Link to post
Share on other sites



This could be tricky, it doesn't look like GDI+ offers full functionality for your needs:

http://www.eggheadcafe.com/forumarchives/p...ost23355421.asp

That's what I noticed also. I'm hoping there is a DLL or other tool I can use (ImageMagick?) to find that data. The thread you linked mentions an Intel DLL, which I might be able to track down, but I'm not sure how to find documentation for the DLL calls if I do find it.

EDIT: From reading the Wikipedia entry on JPEG, it looks like I may be able to infer a quality level by comparing the filesize with image dimensions, as higher quality will require more bits per pixel. That rough comparison will probably fail for a "noisy" image that doesn't compress well, though.

I'll try some tests with that approach, but would love to have a "proper" solution if one exists.

Share this post


Link to post
Share on other sites

It may be possible that there isn't actually a "quality" value stored anywhere in the file. I think it may just be part of the compression algorithm. Just something to think about.

Share this post


Link to post
Share on other sites

^^^ This turns out to be correct.

Quality values are totally arbitrary and represented differently by different programs. Any quality value being displayed for an already-created file is just being inferred unless the app stores it in a tag.

So, I'll just do some basic bits per pixel math and use that as a rough guide. Not perfect, but beats having nothing to go by!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0