Detecting JPEG compression?

KW
Posted By
Karsten Wutzke
Dec 23, 2004
Views
665
Replies
5
Status
Closed
Hi all!

I’ve read that there’s no defined compression level scale in the JPEG specification itself. Is there any alternative way to detect the compression level technically?

Even on Wiki, they subtitle three images (the horse) as 10%, 50% and 100%:

http://en.wikipedia.org/wiki/JPEG

But % of what???

I need a somewhat reliable algorithm/formula to check all sorts of JPEG images coming from ***any*** unknown compressor (Photoshop, GIMP, …). I need to reject certain images whose compression level (obviously) is too low.

I could think of a simple relation, like:

Compressed file size
———————- >= X
Uncompressed file size

If an image fails to meet that compression criterion, it is rejected.

I’m not much into JPEG compression, but I presume the dangerous thing about this formula is that this ratio can get pretty small with images having large areas of similar/same colors (like sky on a background).

Consequently, it would be better to have this formula:

Compressed file size
————————————- >= X
Maximum quality compressed file size

Like this, the image’s relative upper bound is taken for comparison – a better approach I might think. But, is there a defined "maximum quality compression level" in JPEG, that I can rely on?

If not, I’m out of luck. The best would probably be to have a human look at each image and decide. But that’s something I want to avoid or minimize.

Any advice is appreciated on this issue!

Karsten

PS: Sorry for xpost 2 so many groups

How to Improve Photoshop Performance

Learn how to optimize Photoshop for maximum speed, troubleshoot common issues, and keep your projects organized so that you can work faster than ever before!

C
Corey
Dec 24, 2004
"Karsten Wutzke" wrote in message
Hi all!

I’ve read that there’s no defined compression level scale in the JPEG specification itself. Is there any alternative way to detect the compression level technically?

Even on Wiki, they subtitle three images (the horse) as 10%, 50% and 100%:
http://en.wikipedia.org/wiki/JPEG

But % of what???

I need a somewhat reliable algorithm/formula to check all sorts of JPEG images coming from ***any*** unknown compressor (Photoshop, GIMP, …). I need to reject certain images whose compression level (obviously) is too low.

I could think of a simple relation, like:

Compressed file size
———————- >= X
Uncompressed file size

If an image fails to meet that compression criterion, it is rejected.
I’m not much into JPEG compression, but I presume the dangerous thing about this formula is that this ratio can get pretty small with images having large areas of similar/same colors (like sky on a background).
Consequently, it would be better to have this formula:

Compressed file size
————————————- >= X
Maximum quality compressed file size

Like this, the image’s relative upper bound is taken for comparison – a better approach I might think. But, is there a defined "maximum quality compression level" in JPEG, that I can rely on?

If not, I’m out of luck. The best would probably be to have a human look at each image and decide. But that’s something I want to avoid or
minimize.
Any advice is appreciated on this issue!

Karsten

PS: Sorry for xpost 2 so many groups

JPEG compression is mostly used to balance file size with image quality. In Photoshop, there is a little slider that allows the user to select the level of compression. Format Options like Baseline Standard, Baseline Optimized and Progressive offer even more tweaking.

In Photoshop’s "Save for Web" panel, you can actually compare visually up to 3 versions of the image, each with different levels of compression, with the original to determine both the (acceptable) quality and resulting file size. Depending on the complexity of the image, some files can be greatly compressed with very little loss in quality.

I’m not sure if there is any way to tell what level of compression has been applied to an image saved as a JPEG, especially considering that one can compress a JPEG, save it, close the file, open it back up, and compress it again. This practice is NOT RECOMMENDED! Plus, it seems you would need to know the original uncompressed value to even make the determination (first equation). And what file type would you use to determine this uncompressed value?

This link may explain more about your specific concern:
http://www.faqs.org/faqs/jpeg-faq/part1/

Quoted from the above site:

"Thus, JPEG is intended for compressing images that will be looked at by humans. If you plan to machine-analyze your images, the small errors introduced by JPEG may be a problem for you, even if they are invisible to the eye."

Happy Holidays!

Peadge 🙂
C
CoMa
Dec 24, 2004
On Thu, 23 Dec 2004 18:33:22 -0800, "Peadge"
wrote:

I’m not sure if there is any way to tell what level of compression has been applied to an image saved as a JPEG, especially considering that one can compress a JPEG, save it, close the file, open it back up, and compress it again. This practice is NOT RECOMMENDED! Plus, it seems you would need to know the original uncompressed value to even make the determination (first equation). And what file type would you use to determine this uncompressed value?

jpgQ – JPEG Quality Estimator
http://www.mediachance.com/digicam/jpgq.htm

How this all works?
Very simple – Load any JPG and press RUN! button.
The software will do some calculating and then display
the values it estimates.

Standard JPEG
Value here apply to most JPEG images.
This is adjusted to the standard 2-1-1 subsampling.

/CoMa
C
Corey
Dec 24, 2004
"CoMa" wrote in message
On Thu, 23 Dec 2004 18:33:22 -0800, "Peadge"
wrote:

I’m not sure if there is any way to tell what level of compression has
been
applied to an image saved as a JPEG, especially considering that one can compress a JPEG, save it, close the file, open it back up, and compress
it
again. This practice is NOT RECOMMENDED! Plus, it seems you would need to know the original uncompressed value to even make the determination
(first
equation). And what file type would you use to determine this
uncompressed
value?

jpgQ – JPEG Quality Estimator
http://www.mediachance.com/digicam/jpgq.htm

How this all works?
Very simple – Load any JPG and press RUN! button.
The software will do some calculating and then display
the values it estimates.

Standard JPEG
Value here apply to most JPEG images.
This is adjusted to the standard 2-1-1 subsampling.

/CoMa

Very interesting! I wonder if this tool will show up in an episode of the upcoming season of CSI!

Peadge 🙂
R
RSD99
Dec 24, 2004
HeHeHeHeHe …

Probably scheduled for CSI:Miami in late-March …

HeHeHeHeHe …

;-))
G
Gadgets
Dec 27, 2004
Size isn’t everything! Have to take into account embedded profile, EXIF, thumbnail and other crap… If you knew they were processed with something like Save For Web, then perhaps image dimensions vs file size would be useful?

Cheers, Jason
Photo folio:
http://gadgetaus.com/photos

Must-have mockup pack for every graphic designer 🔥🔥🔥

Easy-to-use drag-n-drop Photoshop scene creator with more than 2800 items.

Related Discussion Topics

Nice and short text about related topics in discussion sections