From cb166786df914b7819455af0c78cf54953338227 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Wed, 24 Sep 2014 16:30:39 -0700 Subject: [PATCH] More JPEG documentation, fixes #890 --- docs/handbook/image-file-formats.rst | 47 ++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/docs/handbook/image-file-formats.rst b/docs/handbook/image-file-formats.rst index cd187a4a2..31adcb142 100644 --- a/docs/handbook/image-file-formats.rst +++ b/docs/handbook/image-file-formats.rst @@ -117,20 +117,48 @@ converting ``RGB`` images to ``L``, and resize images to 1/2, 1/4 or 1/8 of their original size while loading them. The :py:meth:`~PIL.Image.Image.draft` method also configures the JPEG decoder to trade some quality for speed. -The :py:meth:`~PIL.Image.Image.open` method sets the following -:py:attr:`~PIL.Image.Image.info` properties: +The :py:meth:`~PIL.Image.Image.open` method may set the following +:py:attr:`~PIL.Image.Image.info` properties if available: **jfif** JFIF application marker found. If the file is not a JFIF file, this key is not present. +**jfif_version** + A tuple representing the jfif version, (major version, minor version). + +**jfif_density** + A tuple representing the pixel density of the image, in units specified + by jfif_unit. + +**jfif_unit** + Units for the jfif_density: + + * 0 - No Units + * 1 - Pixels per Inch + * 2 - Pixels per Centimeter + +**dpi** + A tuple representing the reported pixel density in pixels per inch, if + the file is a jfif file and the units are in inches. + **adobe** Adobe application marker found. If the file is not an Adobe JPEG file, this key is not present. +**adobe_transform** + Vendor Specific Tag. + **progression** Indicates that this is a progressive JPEG file. +**icc-profile** + The ICC color profile for the image. + +**exif** + Raw EXIF data from the image. + + The :py:meth:`~PIL.Image.Image.save` method supports the following options: **quality** @@ -147,6 +175,19 @@ The :py:meth:`~PIL.Image.Image.save` method supports the following options: If present, indicates that this image should be stored as a progressive JPEG file. +**dpi** + A tuple of integers representing the pixel density, ``(x,y)``. + +**icc-profile** + If present, the image is stored with the provided ICC profile. If + this parameter is not provided, the image will be saved with no + profile attached. To preserve the existing profile:: + + im.save(filename, 'jpeg', icc_profile=im.info.get('icc_profile')) + +**exif** + If present, the image will be stored with the provided raw EXIF data. + **subsampling** If present, sets the subsampling for the encoder. @@ -670,7 +711,7 @@ files, using either JPEG or HEX encoding depending on the image mode (and whether JPEG support is available or not). PIXAR (read only) -^^^^ +^^^^^^^^^^^^^^^^^ PIL provides limited support for PIXAR raster files. The library can identify and read “dumped” RGB files.