This may be presumed to apply to a single compression process (like
Adobe Photoshop or Acrobat Distiller, say).
I realise that the linear "quality" gets translated to coefficients of
various kinds, but are they stored, making it possible to get back the
original quality settings, or does the decompression work without that
context?
If the info is there to be found, I'll buy the Giant Book of JPEG and
read it.
----------------------------------------
Aandi Inston qu...@dial.pipex.com
Visit http://www.quite.com/ps/ for information on
PostScript, including EPS in 10 easy stages.
It is certainly possible to inspect the quantization tables stored
in a JPEG file. If you know which encoder produced the file then
you can determine what quality setting it was set at. If you
*don't* know which encoder produced the file then the question is
rather meaningless, since different JPEG implementations offer
different quality scales (= mappings from user-specified quality
numbers to quantization tables).
You might be entertained by looking at
ftp://ftp.netcom.com/pub/tg/tgl/jpeg/jpegdump.zip.
regards, tom lane
organizer, Independent JPEG Group
BugBear.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
On some compressors, when you change quality setting, you may be
changing the subsampling as well as the quantization. (3) It could be
that the compressor does not even follow exactly the quantization values
that are in the DQT marker segment(s), for various reaons (for example,
the quantization interval about 0 may be enlarged sometimes to save
bits). If that was done, there is no way to find out what was the
actual quality of compression from the stream. But this is not commonly
done.
If you actually want to read the JPEG markers to get this information,
it is very simple, but you probably will need to get the "Giant Book"
(Pennebaker-Mitchell), or the ISO spec, to figure out how to do it (or
get someone else who has read the spec to show you how).
Sorry, no simple answers I'm afraid, but hope this helps.
Good luck,
jack
(member, jpeg standards committee)
--
| Check out "BETTER JPEG" live: http://www.jpegwizard.com/ |
| Come see us at the 9th Annual Borland Conference in Denver |
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| Jack Berlin - Pegasus Imaging Corp - BETTER DIGITAL IMAGING! |
| http://www.jpg.com/ - jbe...@jpg.com - 813-875-7575 x303 |
|--------------------------------------------------------------|
Aandi Inston wrote:
>
> I'd be glad of a quick possible/impossible judgement on whether the
> "quality" settings in a JPEG data stream can be deduced in any
> reliable way from the stream itself?
>
> This may be presumed to apply to a single compression process (like
> Adobe Photoshop or Acrobat Distiller, say).
>
>qu...@dial.pipex.com (Aandi Inston) writes:
>> I'd be glad of a quick possible/impossible judgement on whether the
>> "quality" settings in a JPEG data stream can be deduced in any
>> reliable way from the stream itself?
>> This may be presumed to apply to a single compression process (like
>> Adobe Photoshop or Acrobat Distiller, say).
>
>It is certainly possible to inspect the quantization tables stored
>in a JPEG file. If you know which encoder produced the file then
>you can determine what quality setting it was set at. If you
>*don't* know which encoder produced the file then the question is
>rather meaningless, since different JPEG implementations offer
>different quality scales (= mappings from user-specified quality
>numbers to quantization tables).
>
>You might be entertained by looking at
>ftp://ftp.netcom.com/pub/tg/tgl/jpeg/jpegdump.zip.
I was indeed. Thanks to all for the information. For what it's worth,
this is the result, which is specifically designed to identify what
level of JPEG compression was used by Acrobat Distiller, when
examining the contents of a PDF file. Not exhaustively tested but
seems to work.
/* Routine to get the DQT without its type and length */
if ( GetDQTFromStream ( obj , &dqt , &dqtlength ) )
{
strcpy ( buffer , "unknown" ) ;
if ( dqtlength > 64 )
{
unsigned char *d = (unsigned char *)dqt ;
if ( d[1] == 2 && d[64] == 10 )
strcpy ( buffer , "low" ) ;
else if ( d[1] == 4 && d[64] == 20 )
strcpy ( buffer , "med-low" ) ;
else if ( d[1] == 8 && d[64] == 39 )
strcpy ( buffer , "medium" ) ;
else if ( d[1] == 14 && d[64] == 64 )
strcpy ( buffer , "med-high" ) ;
else if ( d[1] == 18 && d[64] == 68 )
strcpy ( buffer , "high" ) ;
}
FreeDQTArea ( dqt ) ;
You're quite right, the quantization tables are not the whole story.
There is the issue of subsampling settings (for color images), as
well as the filtering techniques that you allude to. But Aandi was
asking about determining the original quality setting assuming that
the source encoder was known. Since all JPEG encoders I know about
change the quantization tables at every quality stop (whatever else
they may change), looking at those tables should do.
Sorry people, I don't know what's going on. I posted this weeks ago.
How the hell it's appeared again I do not know.