ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: gbartoli on April 20, 2017, 11:29:49 AM

Title: Extract JPEG Quantization Tables
Post by: gbartoli on April 20, 2017, 11:29:49 AM
Hi to everybody!
I am doing some personal research on image forensics and I implemented a small program to extract JPEG Quantization Tables and estimate the image quality using standard libjpeg reference (in a way similar to Forensically webapp [https://29a.ch/2017/02/05/jpeg-forensics-in-forensically/ (https://29a.ch/2017/02/05/jpeg-forensics-in-forensically/)]).
I successfully used -htmldump to inspect header structure, but I am wondering if EXIFTOOL has an option to directly recover Luminance and Chrominance QT from a JPEG file... is there an option that I am missing?

Thanks,
best regards
Title: Re: Extract JPEG Quantization Tables
Post by: Phil Harvey on April 20, 2017, 01:08:34 PM
Hi Guido,

There are a couple of Extra tags (https://exiftool.org/TagNames/Extra.html) which may interest you.  Take a look at JPEGQualityEstimate and maybe JPEGDigest.

- Phil
Title: Re: Extract JPEG Quantization Tables
Post by: gbartoli on April 21, 2017, 12:39:10 PM
​Ok, I did not know about them!

JPEGQualityEstimate is working fine, the quality level is almost identical to the output of my test program, however JPEGDigest only computes an MD5 digest, but does not extract actual QTs. If you plan to insert this feature into future ExifTool version, please let me know and I can provide you my C code for QT extraction, is pretty fast and overcomes some bugs in the original HackerFactor code ;)

Thanks for the informations,
Best regards
Title: Re: Extract JPEG Quantization Tables
Post by: Phil Harvey on April 21, 2017, 12:54:54 PM
Hi Guido,

Exactly how/why would you want to extract the QT's.  The JPEGDigest computes a digest of them to allow some sort of identification, but beyond that I don't know what would be useful.

- Phil
Title: Re: Extract JPEG Quantization Tables
Post by: gbartoli on April 22, 2017, 05:41:23 AM
Hi Phil,
I'm working for a digital image forensic project and I'm implementing some algorithms for detecting forgeries.

Some methods rely on identifying image source by comparing QTs with a knowledge base (in that case JPEGDigest is very useful), but sometimes JPEG images are not compressed with standard QT (base JPEG values scaled with a fixed factor), but they have non-standard values resulting from ad-hoc optimization tailored for the actual image content.
Some example are JPEGmini, TinyPNG, MozJpeg and DCTune, that analyze perceptual quality to find QTs with best compromise between visual distortion and file size. The resulting QTs are almost unique and it is difficult to find exact correspondence in a database or previous examples.

Here are some links to scientific papers on this matter:

Cheers