Main Projects Background
PentiumGCC EGCS ==Judge==
FreeISDN Gimp Destripe
lsys FCrackZip root-tail
lma-init PApp Suxus
LibLZF ISO tables Xcb
speedstep Deliantra MORPG

Last change: 2007-10-15



Have you ever asked yourself which of two given jpegs (same size) is the "original", i.e. which one was saved with higher quality? No? Then Go Away... Yes? Then Read On...

I often happened to ask myself wether this question can be answered at all. Sure, for general pictures, "higher quality" is a tough decision... a sharp picture (sharpened by a program for example) might have less quality (=originality !redundancy) than the fuzzy original. Judge only tries to answer which picture was saved in a higher quality, but this includes every save, i.e. I want to detect even the case when I picture was saved at low quality and later at high quality.

By a statistical analysis over the quantization table stored in a jpeg one could probably deduce the quality which the picture was saved (i.e. this particular save), but it does in no way say anything about the picture quality itself (i.e. wether it has ever been saved at lower quality before in it's life). For example, one might have saved a jpeg picture in low quality, and later saved in higher quality, yet the information lost during the first save can't be restored.

Judge makes an algorithmic analysis very similar to the jpeg compression algorithm, and then uses an heuristic to "guess" a quality factor between 0 and 1000.

Download the program source here:


How does it perform?

To verify that the program actually works, I made a series of tests. I took four pictures:
a standard jpeg, showing the picture of an eagle (see top of the page). It's 800x600.
a picture taken from the net.
a photo of a rug with very visible structure. Simple downscaling creates all sorts of aliasing effects.
A synthetic picture of a blend from black to white, dithered to only four colours.
First, I took the pictures and recompressed them with different jpeg qualities, and then judge'd the result. If the program (and the pictures) were perfect, we would see the identity function (after appropriate scaling).

quality/quality graph
X = Quality
Y = Judge's guess

As you can see, it is not the identity function. In the high quality region, this is easy to explain: the original pictures were jpeg's themselves, and these were definitely not saved with 100% quality.

The only picture with monotonic curve is "farbverlauf", a synthetic picture that was available in 100% quality.

Also, the behaviour of the curves is different in the x = [0..50[ range than in the x = [50..100] range. This is probably because the IJG JPEG library which was used to compress these pictures doesn't use a linear function to map "quality" (a value between 0 and 100%) into quantization factors.

Next I scaled the pictures to 10% .. 200% of their original size, while holding the quality constant at 70. A simple scaling algorithm without oversampling/subsampling was used. Again, perfect behaviour would result in a constant function.

size/quality graph
X = Image size in percent
Y = Judge's guess

The result for the "farbverlauf" and "treppe" pictures is quite irregular. This can be explained by the aliasing effects with these pictures, which, at some sizes, really distort them.

To check this, I made the same test, only this time using a high-quality re-sampling algorithm (ImageMagick's -sample switch)

size/quality graph
X = Image size in percent
Y = Judge's guess

Due to pgcc (mis?)optimization, ImageMagick refused to make small (<30%) images, so I only checked larger sizes.

As you can see, now the irregularity is gone, and while the curve still is not constant, but increasing with smaller sizes), it seems that judge does a relatively good job.

(GNUPlot 3.5 was used to plot these graphs.)


Any questions/hints/critics? Contact the author of this page!

Main Projects Background