Reference for modules whose documentation has not yet been ported or written can be found here.
Bases: PIL.FontFile.FontFile
The ImageFileIO module can be used to read an image from a socket, or any other stream device.
Deprecated. New code should use the PIL.ImageFile.Parser class in the PIL.ImageFile module instead.
See also
modules PIL.ImageFile.Parser
Bases: PIL.ImageShow.UnixViewer
Bases: PIL.ImageShow.Viewer
Bases: PIL.ImageShow.UnixViewer
Bases: PIL.ImageTransform.Transform
Bases: PIL.ImageTransform.Transform
Bases: PIL.ImageTransform.Transform
Bases: PIL.ImageTransform.Transform
JPEG quality settings equivalent to the Photoshop settings.
More presets can be added to the presets dict if needed.
Can be use when saving JPEG file.
To apply the preset, specify:
quality="preset_name"
To apply only the quantization table:
qtables="preset_name"
To apply only the subsampling setting:
subsampling="preset_name"
Example:
im.save("image_name.jpg", quality="web_high")
Subsampling is the practice of encoding images by implementing less resolution for chroma information than for luma information. (ref.: http://en.wikipedia.org/wiki/Chroma_subsampling)
Possible subsampling values are 0, 1 and 2 that correspond to 4:4:4, 4:2:2 and 4:1:1 (or 4:2:0?).
You can get the subsampling of a JPEG with the JpegImagePlugin.get_subsampling(im) function.
They are values use by the DCT (Discrete cosine transform) to remove unnecessary information from the image (the lossy part of the compression). (ref.: http://en.wikipedia.org/wiki/Quantization_matrix#Quantization_matrices, http://en.wikipedia.org/wiki/JPEG#Quantization)
You can get the quantization tables of a JPEG with:
im.quantization
This will return a dict with a number of arrays. You can pass this dict directly as the qtables argument when saving a JPEG.
The tables format between im.quantization and quantization in presets differ in 3 ways:
You can convert the dict format to the preset format with the JpegImagePlugin.convert_dict_qtables(dict_qtables) function.
Libjpeg ref.: http://www.jpegcameras.com/libjpeg/libjpeg-3.html
OLE container object
This class encapsulates the interface to an OLE 2 structured storage file. Use the listdir and openstream methods to access the contents of this file.
Object names are given as a list of strings, one for each subentry level. The root entry should be omitted. For example, the following code extracts all image streams from a Microsoft Image Composer file:
ole = OleFileIO("fan.mic")
for entry in ole.listdir():
if entry[1:2] == "Image":
fin = ole.openstream(entry)
fout = open(entry[0:1], "wb")
while 1:
s = fin.read(8192)
if not s:
break
fout.write(s)
You can use the viewer application provided with the Python Imaging Library to view the resulting files (which happens to be standard TIFF files).
Bases: PIL.FontFile.FontFile
Bases: PIL.ContainerIO.ContainerIO