[Image-SIG] How to get quality of picture

Fredrik Lundh fredrik at pythonware.com
Mon Sep 28 14:43:00 CEST 2009

The quality setting is used to create a quantization table which is
then used by the compression algorithm.  There's no pre-defined
mapping between quality and the contents of the quantization table for
JPEG (different implementations do different things), but some
applications attempt to guess by comparing the quantization tables in
the file with known mapping algorithms.  I'm not aware of any such
code for Python.

If you want to tinker with this, you can access the quantization table
of an opened JPEG file via the "quantization" attribute.


On Mon, Sep 28, 2009 at 9:08 AM, qiaohl <qiaohl at ucweb.com> wrote:
> Hi,all
>    Is there any function in PIL to get the value of JPEG quality(1-100)? I
> know there are functions to set this value, But I found no function to get
> this value of an existing JPEG file.
> Thanks!
> 2009-09-28
> ________________________________
> qiaohl
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig

More information about the Image-SIG mailing list