merge from master

This commit is contained in:
wiredfool 2013-05-13 09:17:52 -07:00
commit 310341cec7
125 changed files with 1606 additions and 3815 deletions

View File

@ -202,7 +202,7 @@ class ImageCmsTransform(Image.ImagePointHandler):
##
# (experimental) Fetches the profile for the current display device.
# Returns None if the profile is not known.
# @return None if the profile is not known.
def get_display_profile(handle=None):
import sys
@ -234,59 +234,50 @@ class PyCMSError(Exception):
##
# (pyCMS) Applies an ICC transformation to a given image, mapping from
# inputProfile to outputProfile.
#
# If the input or output profiles specified are not valid filenames, a
# PyCMSError will be raised. If inPlace == TRUE and outputMode != im.mode,
# a PyCMSError will be raised. If an error occurs during application of
# the profiles, a PyCMSError will be raised. If outputMode is not a mode
# supported by the outputProfile (or by pyCMS), a PyCMSError will be
# raised.
#
# This function applies an ICC transformation to im from inputProfile's
# color space to outputProfile's color space using the specified rendering
# intent to decide how to handle out-of-gamut colors.
#
# OutputMode can be used to specify that a color mode conversion is to
# be done using these profiles, but the specified profiles must be able
# to handle that mode. I.e., if converting im from RGB to CMYK using
# profiles, the input profile must handle RGB data, and the output
# profile must handle CMYK data.
#
# @param im An open PIL image object (i.e. Image.new(...) or Image.open(...), etc.)
# @param inputProfile String, as a valid filename path to the ICC input profile
# you wish to use for this image, or a profile object
# @param outputProfile String, as a valid filename path to the ICC output
# profile you wish to use for this image, or a profile object
# @param renderingIntent Integer (0-3) specifying the rendering intent you wish
# to use for the transform
#
# INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL)
# INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC)
# INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION)
# INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)
#
# see the pyCMS documentation for details on rendering intents and what they do.
# @param outputMode A valid PIL mode for the output image (i.e. "RGB", "CMYK",
# etc.). Note: if rendering the image "inPlace", outputMode MUST be the
# same mode as the input, or omitted completely. If omitted, the outputMode
# will be the same as the mode of the input image (im.mode)
# @param inPlace Boolean (1 = True, None or 0 = False). If True, the original
# image is modified in-place, and None is returned. If False (default), a
# new Image object is returned with the transform applied.
# @param flags Integer (0-...) specifying additional flags
# @return Either None or a new PIL image object, depending on value of inPlace
# @exception PyCMSError
def profileToProfile(im, inputProfile, outputProfile, renderingIntent=INTENT_PERCEPTUAL, outputMode=None, inPlace=0, flags=0):
"""
ImageCms.profileToProfile(im, inputProfile, outputProfile,
[renderingIntent], [outputMode], [inPlace])
Returns either None or a new PIL image object, depending on value of
inPlace (see below).
im = an open PIL image object (i.e. Image.new(...) or
Image.open(...), etc.)
inputProfile = string, as a valid filename path to the ICC input
profile you wish to use for this image, or a profile object
outputProfile = string, as a valid filename path to the ICC output
profile you wish to use for this image, or a profile object
renderingIntent = integer (0-3) specifying the rendering intent you
wish to use for the transform
INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL)
INTENT_RELATIVE_COLORIMETRIC =1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC)
INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION)
INTENT_ABSOLUTE_COLORIMETRIC =3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)
see the pyCMS documentation for details on rendering intents and
what they do.
outputMode = a valid PIL mode for the output image (i.e. "RGB", "CMYK",
etc.). Note: if rendering the image "inPlace", outputMode MUST be
the same mode as the input, or omitted completely. If omitted, the
outputMode will be the same as the mode of the input image (im.mode)
inPlace = BOOL (1 = TRUE, None or 0 = FALSE). If TRUE, the original
image is modified in-place, and None is returned. If FALSE
(default), a new Image object is returned with the transform
applied.
flags = integer (0-...) specifying additional flags
If the input or output profiles specified are not valid filenames, a
PyCMSError will be raised. If inPlace == TRUE and outputMode != im.mode,
a PyCMSError will be raised. If an error occurs during application of
the profiles, a PyCMSError will be raised. If outputMode is not a mode
supported by the outputProfile (or by pyCMS), a PyCMSError will be
raised.
This function applies an ICC transformation to im from inputProfile's
color space to outputProfile's color space using the specified rendering
intent to decide how to handle out-of-gamut colors.
OutputMode can be used to specify that a color mode conversion is to
be done using these profiles, but the specified profiles must be able
to handle that mode. I.e., if converting im from RGB to CMYK using
profiles, the input profile must handle RGB data, and the output
profile must handle CMYK data.
"""
if outputMode is None:
outputMode = im.mode
@ -316,24 +307,19 @@ def profileToProfile(im, inputProfile, outputProfile, renderingIntent=INTENT_PER
##
# (pyCMS) Opens an ICC profile file.
#
# The PyCMSProfile object can be passed back into pyCMS for use in creating
# transforms and such (as in ImageCms.buildTransformFromOpenProfiles()).
#
# If profileFilename is not a vaild filename for an ICC profile, a PyCMSError
# will be raised.
#
# @param profileFilename String, as a valid filename path to the ICC profile you
# wish to open, or a file-like object.
# @return A CmsProfile class object.
# @exception PyCMSError
def getOpenProfile(profileFilename):
"""
ImageCms.getOpenProfile(profileFilename)
Returns a CmsProfile class object.
profileFilename = string, as a valid filename path to the ICC profile
you wish to open, or a file-like object.
The PyCMSProfile object can be passed back into pyCMS for use in creating
transforms and such (as in ImageCms.buildTransformFromOpenProfiles()).
If profileFilename is not a vaild filename for an ICC profile, a
PyCMSError will be raised.
"""
try:
return ImageCmsProfile(profileFilename)
except (IOError, TypeError, ValueError) as v:
@ -343,61 +329,56 @@ def getOpenProfile(profileFilename):
# (pyCMS) Builds an ICC transform mapping from the inputProfile to the
# outputProfile. Use applyTransform to apply the transform to a given
# image.
#
# If the input or output profiles specified are not valid filenames, a
# PyCMSError will be raised. If an error occurs during creation of the
# transform, a PyCMSError will be raised.
#
# If inMode or outMode are not a mode supported by the outputProfile (or
# by pyCMS), a PyCMSError will be raised.
#
# This function builds and returns an ICC transform from the inputProfile
# to the outputProfile using the renderingIntent to determine what to do
# with out-of-gamut colors. It will ONLY work for converting images that
# are in inMode to images that are in outMode color format (PIL mode,
# i.e. "RGB", "RGBA", "CMYK", etc.).
#
# Building the transform is a fair part of the overhead in
# ImageCms.profileToProfile(), so if you're planning on converting multiple
# images using the same input/output settings, this can save you time.
# Once you have a transform object, it can be used with
# ImageCms.applyProfile() to convert images without the need to re-compute
# the lookup table for the transform.
#
# The reason pyCMS returns a class object rather than a handle directly
# to the transform is that it needs to keep track of the PIL input/output
# modes that the transform is meant for. These attributes are stored in
# the "inMode" and "outMode" attributes of the object (which can be
# manually overridden if you really want to, but I don't know of any
# time that would be of use, or would even work).
#
# @param inputProfile String, as a valid filename path to the ICC input profile
# you wish to use for this transform, or a profile object
# @param outputProfile String, as a valid filename path to the ICC output
# profile you wish to use for this transform, or a profile object
# @param inMode String, as a valid PIL mode that the appropriate profile also
# supports (i.e. "RGB", "RGBA", "CMYK", etc.)
# @param outMode String, as a valid PIL mode that the appropriate profile also
# supports (i.e. "RGB", "RGBA", "CMYK", etc.)
# @param renderingIntent Integer (0-3) specifying the rendering intent you
# wish to use for the transform
#
# INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL)
# INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC)
# INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION)
# INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)
#
# see the pyCMS documentation for details on rendering intents and what they do.
# @param flags Integer (0-...) specifying additional flags
# @return A CmsTransform class object.
# @exception PyCMSError
def buildTransform(inputProfile, outputProfile, inMode, outMode, renderingIntent=INTENT_PERCEPTUAL, flags=0):
"""
ImageCms.buildTransform(inputProfile, outputProfile, inMode, outMode,
[renderingIntent])
Returns a CmsTransform class object.
inputProfile = string, as a valid filename path to the ICC input
profile you wish to use for this transform, or a profile object
outputProfile = string, as a valid filename path to the ICC output
profile you wish to use for this transform, or a profile object
inMode = string, as a valid PIL mode that the appropriate profile also
supports (i.e. "RGB", "RGBA", "CMYK", etc.)
outMode = string, as a valid PIL mode that the appropriate profile also
supports (i.e. "RGB", "RGBA", "CMYK", etc.)
renderingIntent = integer (0-3) specifying the rendering intent you
wish to use for the transform
INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL)
INTENT_RELATIVE_COLORIMETRIC =1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC)
INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION)
INTENT_ABSOLUTE_COLORIMETRIC =3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)
see the pyCMS documentation for details on rendering intents and
what they do.
flags = integer (0-...) specifying additional flags
If the input or output profiles specified are not valid filenames, a
PyCMSError will be raised. If an error occurs during creation of the
transform, a PyCMSError will be raised.
If inMode or outMode are not a mode supported by the outputProfile (or
by pyCMS), a PyCMSError will be raised.
This function builds and returns an ICC transform from the inputProfile
to the outputProfile using the renderingIntent to determine what to do
with out-of-gamut colors. It will ONLY work for converting images that
are in inMode to images that are in outMode color format (PIL mode,
i.e. "RGB", "RGBA", "CMYK", etc.).
Building the transform is a fair part of the overhead in
ImageCms.profileToProfile(), so if you're planning on converting multiple
images using the same input/output settings, this can save you time.
Once you have a transform object, it can be used with
ImageCms.applyProfile() to convert images without the need to re-compute
the lookup table for the transform.
The reason pyCMS returns a class object rather than a handle directly
to the transform is that it needs to keep track of the PIL input/output
modes that the transform is meant for. These attributes are stored in
the "inMode" and "outMode" attributes of the object (which can be
manually overridden if you really want to, but I don't know of any
time that would be of use, or would even work).
"""
if not isinstance(renderingIntent, int) or not (0 <= renderingIntent <=3):
raise PyCMSError("renderingIntent must be an integer between 0 and 3")
@ -417,78 +398,74 @@ def buildTransform(inputProfile, outputProfile, inMode, outMode, renderingIntent
# (pyCMS) Builds an ICC transform mapping from the inputProfile to the
# outputProfile, but tries to simulate the result that would be
# obtained on the proofProfile device.
#
# If the input, output, or proof profiles specified are not valid
# filenames, a PyCMSError will be raised.
#
# If an error occurs during creation of the transform, a PyCMSError will
# be raised.
#
# If inMode or outMode are not a mode supported by the outputProfile
# (or by pyCMS), a PyCMSError will be raised.
#
# This function builds and returns an ICC transform from the inputProfile
# to the outputProfile, but tries to simulate the result that would be
# obtained on the proofProfile device using renderingIntent and
# proofRenderingIntent to determine what to do with out-of-gamut
# colors. This is known as "soft-proofing". It will ONLY work for
# converting images that are in inMode to images that are in outMode
# color format (PIL mode, i.e. "RGB", "RGBA", "CMYK", etc.).
#
# Usage of the resulting transform object is exactly the same as with
# ImageCms.buildTransform().
#
# Proof profiling is generally used when using an output device to get a
# good idea of what the final printed/displayed image would look like on
# the proofProfile device when it's quicker and easier to use the
# output device for judging color. Generally, this means that the
# output device is a monitor, or a dye-sub printer (etc.), and the simulated
# device is something more expensive, complicated, or time consuming
# (making it difficult to make a real print for color judgement purposes).
#
# Soft-proofing basically functions by adjusting the colors on the
# output device to match the colors of the device being simulated. However,
# when the simulated device has a much wider gamut than the output
# device, you may obtain marginal results.
#
# @param inputProfile String, as a valid filename path to the ICC input profile
# you wish to use for this transform, or a profile object
# @param outputProfile String, as a valid filename path to the ICC output
# (monitor, usually) profile you wish to use for this transform, or a
# profile object
# @param proofProfile String, as a valid filename path to the ICC proof profile
# you wish to use for this transform, or a profile object
# @param inMode String, as a valid PIL mode that the appropriate profile also
# supports (i.e. "RGB", "RGBA", "CMYK", etc.)
# @param outMode String, as a valid PIL mode that the appropriate profile also
# supports (i.e. "RGB", "RGBA", "CMYK", etc.)
# @param renderingIntent Integer (0-3) specifying the rendering intent you
# wish to use for the input->proof (simulated) transform
#
# INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL)
# INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC)
# INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION)
# INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)
#
# see the pyCMS documentation for details on rendering intents and what they do.
# @param proofRenderingIntent Integer (0-3) specifying the rendering intent you
# wish to use for proof->output transform
#
# INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL)
# INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC)
# INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION)
# INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)
#
# see the pyCMS documentation for details on rendering intents and what they do.
# @param flags Integer (0-...) specifying additional flags
# @return A CmsTransform class object.
# @exception PyCMSError
def buildProofTransform(inputProfile, outputProfile, proofProfile, inMode, outMode, renderingIntent=INTENT_PERCEPTUAL, proofRenderingIntent=INTENT_ABSOLUTE_COLORIMETRIC, flags=FLAGS["SOFTPROOFING"]):
"""
ImageCms.buildProofTransform(inputProfile, outputProfile, proofProfile,
inMode, outMode, [renderingIntent], [proofRenderingIntent])
Returns a CmsTransform class object.
inputProfile = string, as a valid filename path to the ICC input
profile you wish to use for this transform, or a profile object
outputProfile = string, as a valid filename path to the ICC output
(monitor, usually) profile you wish to use for this transform,
or a profile object
proofProfile = string, as a valid filename path to the ICC proof
profile you wish to use for this transform, or a profile object
inMode = string, as a valid PIL mode that the appropriate profile also
supports (i.e. "RGB", "RGBA", "CMYK", etc.)
outMode = string, as a valid PIL mode that the appropriate profile also
supports (i.e. "RGB", "RGBA", "CMYK", etc.)
renderingIntent = integer (0-3) specifying the rendering intent you
wish to use for the input->proof (simulated) transform
INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL)
INTENT_RELATIVE_COLORIMETRIC =1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC)
INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION)
INTENT_ABSOLUTE_COLORIMETRIC =3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)
see the pyCMS documentation for details on rendering intents and
what they do.
proofRenderingIntent = integer (0-3) specifying the rendering intent
you wish to use for proof->output transform
INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL)
INTENT_RELATIVE_COLORIMETRIC =1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC)
INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION)
INTENT_ABSOLUTE_COLORIMETRIC =3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)
see the pyCMS documentation for details on rendering intents and
what they do.
flags = integer (0-...) specifying additional flags
If the input, output, or proof profiles specified are not valid
filenames, a PyCMSError will be raised.
If an error occurs during creation of the transform, a PyCMSError will
be raised.
If inMode or outMode are not a mode supported by the outputProfile
(or by pyCMS), a PyCMSError will be raised.
This function builds and returns an ICC transform from the inputProfile
to the outputProfile, but tries to simulate the result that would be
obtained on the proofProfile device using renderingIntent and
proofRenderingIntent to determine what to do with out-of-gamut
colors. This is known as "soft-proofing". It will ONLY work for
converting images that are in inMode to images that are in outMode
color format (PIL mode, i.e. "RGB", "RGBA", "CMYK", etc.).
Usage of the resulting transform object is exactly the same as with
ImageCms.buildTransform().
Proof profiling is generally used when using an output device to get a
good idea of what the final printed/displayed image would look like on
the proofProfile device when it's quicker and easier to use the
output device for judging color. Generally, this means that the
output device is a monitor, or a dye-sub printer (etc.), and the simulated
device is something more expensive, complicated, or time consuming
(making it difficult to make a real print for color judgement purposes).
Soft-proofing basically functions by adjusting the colors on the
output device to match the colors of the device being simulated. However,
when the simulated device has a much wider gamut than the output
device, you may obtain marginal results.
"""
if not isinstance(renderingIntent, int) or not (0 <= renderingIntent <=3):
raise PyCMSError("renderingIntent must be an integer between 0 and 3")
@ -511,48 +488,41 @@ buildProofTransformFromOpenProfiles = buildProofTransform
##
# (pyCMS) Applies a transform to a given image.
#
# If im.mode != transform.inMode, a PyCMSError is raised.
#
# If inPlace == TRUE and transform.inMode != transform.outMode, a
# PyCMSError is raised.
#
# If im.mode, transfer.inMode, or transfer.outMode is not supported by
# pyCMSdll or the profiles you used for the transform, a PyCMSError is
# raised.
#
# If an error occurs while the transform is being applied, a PyCMSError
# is raised.
#
# This function applies a pre-calculated transform (from
# ImageCms.buildTransform() or ImageCms.buildTransformFromOpenProfiles()) to an
# image. The transform can be used for multiple images, saving
# considerable calcuation time if doing the same conversion multiple times.
#
# If you want to modify im in-place instead of receiving a new image as
# the return value, set inPlace to TRUE. This can only be done if
# transform.inMode and transform.outMode are the same, because we can't
# change the mode in-place (the buffer sizes for some modes are
# different). The default behavior is to return a new Image object of
# the same dimensions in mode transform.outMode.
#
# @param im A PIL Image object, and im.mode must be the same as the inMode
# supported by the transform.
# @param transform A valid CmsTransform class object
# @param inPlace Bool (1 == True, 0 or None == False). If True, im is modified
# in place and None is returned, if False, a new Image object with the
# transform applied is returned (and im is not changed). The default is False.
# @return Either None, or a new PIL Image object, depending on the value of inPlace
# @exception PyCMSError
def applyTransform(im, transform, inPlace=0):
"""
ImageCms.applyTransform(im, transform, [inPlace])
Returns either None, or a new PIL Image object, depending on the value
of inPlace (see below)
im = a PIL Image object, and im.mode must be the same as the inMode
supported by the transform.
transform = a valid CmsTransform class object
inPlace = BOOL (1 == TRUE, 0 or None == FALSE). If TRUE, im is
modified in place and None is returned, if FALSE, a new Image
object with the transform applied is returned (and im is not
changed). The default is FALSE.
If im.mode != transform.inMode, a PyCMSError is raised.
If inPlace == TRUE and transform.inMode != transform.outMode, a
PyCMSError is raised.
If im.mode, transfer.inMode, or transfer.outMode is not supported by
pyCMSdll or the profiles you used for the transform, a PyCMSError is
raised.
If an error occurs while the transform is being applied, a PyCMSError
is raised.
This function applies a pre-calculated transform (from
ImageCms.buildTransform() or ImageCms.buildTransformFromOpenProfiles()) to an
image. The transform can be used for multiple images, saving
considerable calcuation time if doing the same conversion multiple times.
If you want to modify im in-place instead of receiving a new image as
the return value, set inPlace to TRUE. This can only be done if
transform.inMode and transform.outMode are the same, because we can't
change the mode in-place (the buffer sizes for some modes are
different). The default behavior is to return a new Image object of
the same dimensions in mode transform.outMode.
"""
try:
if inPlace:
transform.apply_in_place(im)
@ -566,33 +536,29 @@ def applyTransform(im, transform, inPlace=0):
##
# (pyCMS) Creates a profile.
#
# If colorSpace not in ["LAB", "XYZ", "sRGB"], a PyCMSError is raised
#
# If using LAB and colorTemp != a positive integer, a PyCMSError is raised.
#
# If an error occurs while creating the profile, a PyCMSError is raised.
#
# Use this function to create common profiles on-the-fly instead of
# having to supply a profile on disk and knowing the path to it. It
# returns a normal CmsProfile object that can be passed to
# ImageCms.buildTransformFromOpenProfiles() to create a transform to apply
# to images.
#
# @param colorSpace String, the color space of the profile you wish to create.
# Currently only "LAB", "XYZ", and "sRGB" are supported.
# @param colorTemp Positive integer for the white point for the profile, in
# degrees Kelvin (i.e. 5000, 6500, 9600, etc.). The default is for D50
# illuminant if omitted (5000k). colorTemp is ONLY applied to LAB profiles,
# and is ignored for XYZ and sRGB.
# @return A CmsProfile class object
# @exception PyCMSError
def createProfile(colorSpace, colorTemp=-1):
"""
ImageCms.createProfile(colorSpace, [colorTemp])
Returns a CmsProfile class object
colorSpace = string, the color space of the profile you wish to create.
Currently only "LAB", "XYZ", and "sRGB" are supported.
colorTemp = positive integer for the white point for the profile, in
degrees Kelvin (i.e. 5000, 6500, 9600, etc.). The default is for
D50 illuminant if omitted (5000k). colorTemp is ONLY applied to
LAB profiles, and is ignored for XYZ and sRGB.
If colorSpace not in ["LAB", "XYZ", "sRGB"], a PyCMSError is raised
If using LAB and colorTemp != a positive integer, a PyCMSError is raised.
If an error occurs while creating the profile, a PyCMSError is raised.
Use this function to create common profiles on-the-fly instead of
having to supply a profile on disk and knowing the path to it. It
returns a normal CmsProfile object that can be passed to
ImageCms.buildTransformFromOpenProfiles() to create a transform to apply
to images.
"""
if colorSpace not in ["LAB", "XYZ", "sRGB"]:
raise PyCMSError("Color space not supported for on-the-fly profile creation (%s)" % colorSpace)
@ -609,27 +575,23 @@ def createProfile(colorSpace, colorTemp=-1):
##
# (pyCMS) Gets the internal product name for the given profile.
#
# If profile isn't a valid CmsProfile object or filename to a profile,
# a PyCMSError is raised If an error occurs while trying to obtain the
# name tag, a PyCMSError is raised.
#
# Use this function to obtain the INTERNAL name of the profile (stored
# in an ICC tag in the profile itself), usually the one used when the
# profile was originally created. Sometimes this tag also contains
# additional information supplied by the creator.
#
# @param profile EITHER a valid CmsProfile object, OR a string of the filename
# of an ICC profile.
# @return A string containing the internal name of the profile as stored in an
# ICC tag.
# @exception PyCMSError
def getProfileName(profile):
"""
ImageCms.getProfileName(profile)
Returns a string containing the internal name of the profile as stored
in an ICC tag.
profile = EITHER a valid CmsProfile object, OR a string of the
filename of an ICC profile.
If profile isn't a valid CmsProfile object or filename to a profile,
a PyCMSError is raised If an error occurs while trying to obtain the
name tag, a PyCMSError is raised.
Use this function to obtain the INTERNAL name of the profile (stored
in an ICC tag in the profile itself), usually the one used when the
profile was originally created. Sometimes this tag also contains
additional information supplied by the creator.
"""
try:
# add an extra newline to preserve pyCMS compatibility
if not isinstance(profile, ImageCmsProfile):
@ -640,28 +602,24 @@ def getProfileName(profile):
##
# (pyCMS) Gets the internal product information for the given profile.
#
# If profile isn't a valid CmsProfile object or filename to a profile,
# a PyCMSError is raised.
#
# If an error occurs while trying to obtain the info tag, a PyCMSError
# is raised
#
# Use this function to obtain the information stored in the profile's
# info tag. This often contains details about the profile, and how it
# was created, as supplied by the creator.
#
# @param profile EITHER a valid CmsProfile object, OR a string of the filename
# of an ICC profile.
# @return A string containing the internal profile information stored in an ICC
# tag.
# @exception PyCMSError
def getProfileInfo(profile):
"""
ImageCms.getProfileInfo(profile)
Returns a string containing the internal profile information stored in
an ICC tag.
profile = EITHER a valid CmsProfile object, OR a string of the
filename of an ICC profile.
If profile isn't a valid CmsProfile object or filename to a profile,
a PyCMSError is raised.
If an error occurs while trying to obtain the info tag, a PyCMSError
is raised
Use this function to obtain the information stored in the profile's
info tag. This often contains details about the profile, and how it
was created, as supplied by the creator.
"""
try:
if not isinstance(profile, ImageCmsProfile):
profile = ImageCmsProfile(profile)
@ -672,35 +630,32 @@ def getProfileInfo(profile):
##
# (pyCMS) Gets the default intent name for the given profile.
#
# If profile isn't a valid CmsProfile object or filename to a profile,
# a PyCMSError is raised.
#
# If an error occurs while trying to obtain the default intent, a
# PyCMSError is raised.
#
# Use this function to determine the default (and usually best optomized)
# rendering intent for this profile. Most profiles support multiple
# rendering intents, but are intended mostly for one type of conversion.
# If you wish to use a different intent than returned, use
# ImageCms.isIntentSupported() to verify it will work first.
#
# @param profile EITHER a valid CmsProfile object, OR a string of the filename
# of an ICC profile.
# @return Integer 0-3 specifying the default rendering intent for this profile.
#
# INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL)
# INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC)
# INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION)
# INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)
#
# see the pyCMS documentation for details on rendering intents and what they do.
# @exception PyCMSError
def getDefaultIntent(profile):
"""
ImageCms.getDefaultIntent(profile)
Returns integer 0-3 specifying the default rendering intent for this
profile.
INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL)
INTENT_RELATIVE_COLORIMETRIC =1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC)
INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION)
INTENT_ABSOLUTE_COLORIMETRIC =3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)
see the pyCMS documentation for details on rendering intents and
what they do.
profile = EITHER a valid CmsProfile object, OR a string of the
filename of an ICC profile.
If profile isn't a valid CmsProfile object or filename to a profile,
a PyCMSError is raised.
If an error occurs while trying to obtain the default intent, a
PyCMSError is raised.
Use this function to determine the default (and usually best optomized)
rendering intent for this profile. Most profiles support multiple
rendering intents, but are intended mostly for one type of conversion.
If you wish to use a different intent than returned, use
ImageCms.isIntentSupported() to verify it will work first.
"""
try:
if not isinstance(profile, ImageCmsProfile):
profile = ImageCmsProfile(profile)
@ -710,41 +665,40 @@ def getDefaultIntent(profile):
##
# (pyCMS) Checks if a given intent is supported.
#
# Use this function to verify that you can use your desired
# renderingIntent with profile, and that profile can be used for the
# input/output/proof profile as you desire.
#
# Some profiles are created specifically for one "direction", can cannot
# be used for others. Some profiles can only be used for certain
# rendering intents... so it's best to either verify this before trying
# to create a transform with them (using this function), or catch the
# potential PyCMSError that will occur if they don't support the modes
# you select.
#
# @param profile EITHER a valid CmsProfile object, OR a string of the filename
# of an ICC profile.
# @param intent Integer (0-3) specifying the rendering intent you wish to use
# with this profile
#
# INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL)
# INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC)
# INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION)
# INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)
#
# see the pyCMS documentation for details on rendering intents and what they do.
# @param direction Integer specifing if the profile is to be used for input,
# output, or proof
#
# INPUT = 0 (or use ImageCms.DIRECTION_INPUT)
# OUTPUT = 1 (or use ImageCms.DIRECTION_OUTPUT)
# PROOF = 2 (or use ImageCms.DIRECTION_PROOF)
#
# @return 1 if the intent/direction are supported, -1 if they are not.
# @exception PyCMSError
def isIntentSupported(profile, intent, direction):
"""
ImageCms.isIntentSupported(profile, intent, direction)
Returns 1 if the intent/direction are supported, -1 if they are not.
profile = EITHER a valid CmsProfile object, OR a string of the
filename of an ICC profile.
intent = integer (0-3) specifying the rendering intent you wish to use
with this profile
INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL)
INTENT_RELATIVE_COLORIMETRIC =1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC)
INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION)
INTENT_ABSOLUTE_COLORIMETRIC =3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)
see the pyCMS documentation for details on rendering intents and
what they do.
direction = integer specifing if the profile is to be used for input,
output, or proof
INPUT = 0 (or use ImageCms.DIRECTION_INPUT)
OUTPUT = 1 (or use ImageCms.DIRECTION_OUTPUT)
PROOF = 2 (or use ImageCms.DIRECTION_PROOF)
Use this function to verify that you can use your desired
renderingIntent with profile, and that profile can be used for the
input/output/proof profile as you desire.
Some profiles are created specifically for one "direction", can cannot
be used for others. Some profiles can only be used for certain
rendering intents... so it's best to either verify this before trying
to create a transform with them (using this function), or catch the
potential PyCMSError that will occur if they don't support the modes
you select.
"""
try:
if not isinstance(profile, ImageCmsProfile):
profile = ImageCmsProfile(profile)

View File

@ -30,6 +30,11 @@ from __future__ import print_function
from PIL import Image
import os, sys
try:
import warnings
except ImportError:
warnings = None
class _imagingft_not_installed:
# module placeholder
def __getattr__(self, id):
@ -40,6 +45,13 @@ try:
except ImportError:
core = _imagingft_not_installed()
if bytes is str:
def isStringType(t):
return isinstance(t, basestring)
else:
def isStringType(t):
return isinstance(t, str)
# FIXME: add support for pilfont2 format (see FontFile.py)
# --------------------------------------------------------------------
@ -129,9 +141,18 @@ class ImageFont:
class FreeTypeFont:
"FreeType font wrapper (requires _imagingft service)"
def __init__(self, file, size, index=0, encoding=""):
def __init__(self, font=None, size=10, index=0, encoding="", file=None):
# FIXME: use service provider instead
self.font = core.getfont(file, size, index, encoding)
if file:
if warnings:
warnings.warn('file parameter deprecated, please use font parameter instead.', DeprecationWarning)
font = file
if isStringType(font):
self.font = core.getfont(font, size, index, encoding)
else:
self.font_bytes = font.read()
self.font = core.getfont("", size, index, encoding, self.font_bytes)
def getname(self):
return self.font.family, self.font.style
@ -212,10 +233,16 @@ def load(filename):
# @return A font object.
# @exception IOError If the file could not be read.
def truetype(filename, size, index=0, encoding=""):
def truetype(font=None, size=10, index=0, encoding="", filename=None):
"Load a truetype font file."
if filename:
if warnings:
warnings.warn('filename parameter deprecated, please use font parameter instead.', DeprecationWarning)
font = filename
try:
return FreeTypeFont(filename, size, index, encoding)
return FreeTypeFont(font, size, index, encoding)
except IOError:
if sys.platform == "win32":
# check the windows font repository
@ -223,8 +250,8 @@ def truetype(filename, size, index=0, encoding=""):
# 1.5.2's os.environ.get()
windir = os.environ.get("WINDIR")
if windir:
filename = os.path.join(windir, "fonts", filename)
return FreeTypeFont(filename, size, index, encoding)
filename = os.path.join(windir, "fonts", font)
return FreeTypeFont(font, size, index, encoding)
raise
##

View File

@ -5,21 +5,21 @@ More presets can be added to the presets dict if needed.
Can be use when saving JPEG file.
To apply the preset, specify:
To apply the preset, specify::
- quality=preset name
To apply only the quantization table:
quality="preset_name"
- qtables=preset name
To apply only the quantization table::
To apply only the subsampling setting:
qtables="preset_name"
- subsampling=preset name
To apply only the subsampling setting::
Example:
subsampling="preset_name"
im.save("image_name.jpg", quality="web_high")
Example::
im.save("image_name.jpg", quality="web_high")
Subsampling
@ -28,7 +28,7 @@ Subsampling
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?).
@ -42,25 +42,23 @@ Quantization tables
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)
http://en.wikipedia.org/wiki/JPEG#Quantization)
You can get the quantization tables of a JPEG with:
You can get the quantization tables of a JPEG with::
im.quantization
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:
1. The base container of the preset is a list with sublists instead of dict.
dict[0] -> list[0], dict[1] -> list[1], ...
2. Each table in a preset is a list instead of an array.
3. The zigzag order is remove in the preset (needed by libjpeg >= 6a).
1. The base container of the preset is a list with sublists instead of dict.
dict[0] -> list[0], dict[1] -> list[1], ...
2. Each table in a preset is a list instead of an array.
3. The zigzag order is remove in the preset (needed by libjpeg >= 6a).
You can convert the dict format to the preset format with the
`JpegImagePlugin.convert_dict_qtables(dict_qtables)` function.
@ -68,7 +66,7 @@ Libjpeg ref.: http://www.jpegcameras.com/libjpeg/libjpeg-3.html
"""
presets = {
presets = {
'web_low': {'subsampling': 2, # "4:1:1"
'quantization': [
[20, 16, 25, 39, 50, 46, 62, 68,
@ -88,7 +86,6 @@ presets = {
68, 68, 68, 68, 68, 68, 68, 68,
68, 68, 68, 68, 68, 68, 68, 68]
]},
'web_medium': {'subsampling': 2, # "4:1:1"
'quantization': [
[16, 11, 11, 16, 23, 27, 31, 30,
@ -108,7 +105,6 @@ presets = {
38, 35, 46, 53, 64, 64, 64, 64,
48, 43, 53, 64, 64, 64, 64, 64]
]},
'web_high': {'subsampling': 0, # "4:4:4"
'quantization': [
[ 6, 4, 4, 6, 9, 11, 12, 16,
@ -128,7 +124,6 @@ presets = {
31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31]
]},
'web_very_high': {'subsampling': 0, # "4:4:4"
'quantization': [
[ 2, 2, 2, 2, 3, 4, 5, 6,
@ -148,7 +143,6 @@ presets = {
15, 12, 12, 12, 12, 12, 12, 12,
15, 12, 12, 12, 12, 12, 12, 12]
]},
'web_maximum': {'subsampling': 0, # "4:4:4"
'quantization': [
[ 1, 1, 1, 1, 1, 1, 1, 1,
@ -168,7 +162,6 @@ presets = {
3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3]
]},
'low': {'subsampling': 2, # "4:1:1"
'quantization': [
[18, 14, 14, 21, 30, 35, 34, 17,
@ -207,7 +200,6 @@ presets = {
17, 12, 12, 12, 12, 12, 12, 12,
17, 12, 12, 12, 12, 12, 12, 12]
]},
'high': {'subsampling': 0, # "4:4:4"
'quantization': [
[ 6, 4, 4, 6, 9, 11, 12, 16,
@ -227,7 +219,6 @@ presets = {
17, 12, 12, 12, 12, 12, 12, 12,
17, 12, 12, 12, 12, 12, 12, 12]
]},
'maximum': {'subsampling': 0, # "4:4:4"
'quantization': [
[ 2, 2, 2, 2, 3, 4, 5, 6,
@ -247,4 +238,4 @@ presets = {
15, 12, 12, 12, 12, 12, 12, 12,
15, 12, 12, 12, 12, 12, 12, 12]
]},
}
}

View File

@ -239,7 +239,7 @@ class OleFileIO:
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:
code extracts all image streams from a Microsoft Image Composer file::
ole = OleFileIO("fan.mic")

View File

@ -149,7 +149,7 @@ def _save(im, fp, filename):
im.putdata(data)
ImageFile._save(im, op, [("hex", (0,0)+im.size, 0, im.mode)])
elif filter == "/DCTDecode":
ImageFile._save(im, op, [("jpeg", (0,0)+im.size, 0, im.mode)])
Image.SAVE["JPEG"](im, op, filename)
elif filter == "/FlateDecode":
ImageFile._save(im, op, [("zip", (0,0)+im.size, 0, im.mode)])
elif filter == "/RunLengthDecode":

View File

@ -615,7 +615,7 @@ class TiffImageFile(ImageFile.ImageFile):
return pixel
self.load_prepare()
if not len(self.tile) == 1:
raise IOError("Not exactly one tile")
@ -635,7 +635,7 @@ class TiffImageFile(ImageFile.ImageFile):
#
# Rearranging for supporting byteio items, since they have a fileno
# that returns an IOError if there's no underlying fp. Easier to deal
# with here by reordering.
# with here by reordering.
if Image.DEBUG:
print ("have getvalue. just sending in a string from getvalue")
n,e = d.decode(self.fp.getvalue())
@ -649,10 +649,10 @@ class TiffImageFile(ImageFile.ImageFile):
# we have something else.
if Image.DEBUG:
print ("don't have fileno or getvalue. just reading")
# UNDONE -- so much for that buffer size thing.
# UNDONE -- so much for that buffer size thing.
n, e = d.decode(self.fp.read())
self.tile = []
self.readonly = 0
self.fp = None # might be shared
@ -723,6 +723,10 @@ class TiffImageFile(ImageFile.ImageFile):
xres = getscalar(X_RESOLUTION, (1, 1))
yres = getscalar(Y_RESOLUTION, (1, 1))
if xres and not isinstance(xres, tuple):
xres = (xres, 1.)
if yres and not isinstance(yres, tuple):
yres = (yres, 1.)
if xres and yres:
xres = xres[0] / (xres[1] or 1)
yres = yres[0] / (yres[1] or 1)
@ -750,19 +754,19 @@ class TiffImageFile(ImageFile.ImageFile):
# Decoder expects entire file as one tile.
# There's a buffer size limit in load (64k)
# so large g4 images will fail if we use that
# function.
# function.
#
# Setup the one tile for the whole image, then
# replace the existing load function with our
# _load_libtiff function.
self.load = self._load_libtiff
# To be nice on memory footprint, if there's a
# file descriptor, use that instead of reading
# into a string in python.
# libtiff closes the file descriptor, so pass in a dup.
# libtiff closes the file descriptor, so pass in a dup.
try:
fp = hasattr(self.fp, "fileno") and os.dup(self.fp.fileno())
except IOError:
@ -990,7 +994,7 @@ def _save(im, fp, filename):
if type(v) == str:
atts[k] = v
continue
except:
# if we don't have an ifd here, just punt.
pass
@ -1007,7 +1011,7 @@ def _save(im, fp, filename):
break
if s < 0:
raise IOError("encoder error %d when writing image file" % s)
else:
offset = ifd.save(fp)

View File

@ -1,7 +1,7 @@
Pillow
======
.. Note:: Pillow >= 2.0.0 supports Python versions: 2.6, 2.7, 3.2, 3.3; Pillow < 2.0.0 supports Python versions: 2.4, 2.5, 2.6, 2.7.
.. Note:: Pillow < 2.0.0 supports Python 2.4, 2.5, 2.6, 2.7; Pillow >= 2.0.0 supports Python 2.6, 2.7, 3.2, 3.3.
.. image:: https://travis-ci.org/python-imaging/Pillow.png
:target: https://travis-ci.org/python-imaging/Pillow
@ -13,16 +13,37 @@ Introduction
The fork author's goal is to foster active development of PIL through:
- Continuous integration testing via Travis-CI
- Publicized development activity on GitHub
- Regular releases to the Python Packaging Index
- Solicitation for community contributions and involvement on Imaging-SIG
- Continuous integration testing via `Travis CI <https://travis-ci.org/python-imaging/Pillow>`_
- Publicized development activity on `GitHub <https://github.com/python-imaging/Pillow>`_
- Regular releases to the `Python Package Index <https://pypi.python.org/pypi/Pillow>`_
- Solicitation for community contributions and involvement on `Image-SIG <http://mail.python.org/mailman/listinfo/image-sig>`_
Porting your PIL code to Pillow
-------------------------------
.. Note:: PIL and Pillow currently cannot co-exist in the same environment. If you want to use Pillow, please remove PIL first.
Pillow is a functional drop-in replacement for the Python Imaging Library. To run your existing PIL-compatible code with Pillow, it needs to be modified to import the ``Imaging`` module from the ``PIL`` namespace *instead* of the global namespace. I.e. change::
import Image
to::
from PIL import Image
.. Note:: If your code imports from ``_imaging``, it will no longer work.
The preferred, future proof method of importing the private ``_imaging`` module is::
from PIL import Image
_imaging = Image.core
Why a fork?
-----------
PIL is not setuptools compatible. Please see http://mail.python.org/pipermail/image-sig/2010-August/006480.html for a more detailed explanation. Also, PIL's current bi-yearly (or greater) release schedule is too infrequent to accomodate the large number and frequency of issues reported.
What about image code bugs?
---------------------------
@ -36,7 +57,7 @@ Then open a ticket here:
and provide a link to the first ticket so we can track the issue(s) upstream.
.. Note:: Prior to Pillow 2.0.0, very few image code changes were made. Pillow 2.0.0 adds Python 3 support and includes many bug fixes from around the internet.
.. Note:: Prior to Pillow 2.0.0, very few image code changes were made. Pillow 2.0.0 adds Python 3 support and includes many bug fixes from many contributors.
Documentation
-------------
@ -46,14 +67,17 @@ The API documentation included with PIL has been converted (from HTML generated
Community
---------
Pillow needs you! Please help us maintain PIL via:
PIL needs you! Please help us maintain the Python Imaging Library here:
- GitHub Code (https://github.com/python-imaging/Pillow)
- Freenode Chat (irc://irc.freenode.net#pil)
- Image-SIG Discussion (http://mail.python.org/mailman/listinfo/image-sig)
- GitHub (https://github.com/python-imaging/Pillow)
- Freenode (irc://irc.freenode.net#pil)
- Image-SIG (http://mail.python.org/mailman/listinfo/image-sig)
Installation
------------
Platform support
----------------
~~~~~~~~~~~~~~~~
Current platform support for Pillow. Binary distributions are contributed for each release on a volunteer basis, but the source should compile and run everywhere platform support is listed. In general, we aim to support all current versions of Linux, OS X, and Windows.
@ -72,6 +96,8 @@ Current platform support for Pillow. Binary distributions are contributed for ea
+----------------------------------+-------------+------------------------------+-----------------------+
| Ubuntu Linux 12.04 LTS |Yes | 2.6,2.7,3.2,3.3 |x86,x86-64 |
+----------------------------------+-------------+------------------------------+-----------------------+
| Gentoo Linux |Soon | 2.7,3.2 |x86-64 |
+----------------------------------+-------------+------------------------------+-----------------------+
| Windows Server 2008 R2 Enterprise|Yes | 3.3 |x86-64 |
+----------------------------------+-------------+------------------------------+-----------------------+
| Windows 8 Pro |Yes | 2.6,2.7,3.2,3.3,PyPy1.9 [1]_ |x86 [2]_,x86-64 |
@ -80,6 +106,94 @@ Current platform support for Pillow. Binary distributions are contributed for ea
.. [1] x86 only
.. [2] In some cases, x86 support may indicate 32-bit compilation on 64-bit architecture (vs. compilation on 32-bit hardware).
.. Note:: XXX Why are we recommending binaries when we only provide Windows eggs?
If there is a binary package for your system, that is the easiest way to install Pillow. Currently we only provide binaries for Windows.
.. Note:: UNDONE: Binary links
.. Note:: XXX Do we really need to provide binary links? At least in the case of eggs… probably not IMHO.
Build from source
~~~~~~~~~~~~~~~~~
Some (most?) of Pillow's features require external libraries.
* **libjpeg** provides JPEG functionality.
* Pillow has been tested with libjpeg versions **6b**, **8**, and **9**
* **zlib** provides access to compressed PNGs
* **libtiff** provides group4 tiff functionality
* Pillow has been tested with libtiff versions **3.x** and **4.0**
* **libfreetype** provides type related services
* **littlecms** provides color management
* **libwebp** provides the Webp format.
If the prerequisites are installed in the standard library locations for your machine (e.g. /usr or /usr/local), no additional configuration should be required. If they are installed in a non-standard location, you may need to configure setuptools to use those locations (i.e. by editing setup.py and/or setup.cfg)
Once you have installed the prerequisites, run:
::
$ pip install Pillow
Platform-specific instructions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Linux
+++++
**We don't currently provide binaries for Linux.** If you didn't build Python from source, make sure you have Python's development libraries installed. In Debian or Ubuntu::
$ sudo apt-get install python-dev python-setuptools
Or for Python 3::
$ sudo apt-get install python3-dev python3-setuptools
Prerequisites are installed on **Ubuntu 10.04 LTS** with::
$ sudo apt-get install libtiff4-dev libjpeg62-dev zlib1g-dev libfreetype6-dev liblcms1-dev
Prerequisites are installed with on **Ubuntu 12.04 LTS** with ::
$ sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms1-dev libwebp-dev
Mac OS X
++++++++
**We don't currently provide binaries for OS X.** So you'll need XCode to install Pillow. (XCode 4.2 on 10.6 will work with the Official Python binary distribution. Otherwise, use whatever XCode you used to compile Python.)
.. Note:: XXX I'm not sure we need to mention the bit about XCode
The easiest way to install the prerequisites is via `Homebrew <http://mxcl.github.com/homebrew/>`_. After you install Homebrew, run:
::
$ brew install libtiff libjpeg webp littlecms
If you've built your own Python, then you should be able to install Pillow using
::
$ pip install Pillow
Windows
+++++++
**We currently provide Python eggs for Windows.**
.. Note:: XXX Mention easy_install Pillow (which should install the right egg)?
Donations
---------

View File

@ -408,7 +408,6 @@ static PyObject *
SaneDev_set_auto_option(SaneDevObject *self, PyObject *args)
{
SANE_Status st;
const SANE_Option_Descriptor *d;
SANE_Int i;
int n;
@ -419,7 +418,6 @@ SaneDev_set_auto_option(SaneDevObject *self, PyObject *args)
PyErr_SetString(ErrorObject, "SaneDev object is closed");
return NULL;
}
d=sane_get_option_descriptor(self->h, n);
st=sane_control_option(self->h, n, SANE_ACTION_SET_AUTO,
NULL, &i);
if (st) {return PySane_Error(st);}

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
#
# The Python Imaging Library
# $Id$

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
#
# The Python Imaging Library
# $Id$

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
#
# The Python Imaging Library
# $Id$

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
#
# The Python Imaging Library
# $Id$

View File

@ -1,4 +1,4 @@
#! /usr/local/bin/python
#!/usr/bin/env python
#
# The Python Imaging Library.
# $Id$

View File

@ -1,4 +1,4 @@
#! /usr/local/bin/python
#!/usr/bin/env python
#
# The Python Imaging Library.
# $Id$

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
#
# The Python Imaging Library
# $Id$
@ -13,8 +14,7 @@ from __future__ import print_function
VERSION = "0.4"
import site
import glob, os, sys
import glob, sys
# drivers
from PIL import BdfFontFile

View File

@ -1,4 +1,4 @@
#! /usr/local/bin/python
#!/usr/bin/env python
#
# The Python Imaging Library.
# $Id$

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
#
# The Python Imaging Library
# $Id$

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
#
# The Python Imaging Library
# $Id$

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
#
# The Python Imaging Library
# $Id$

BIN
Tests/fonts/FreeMono.ttf Normal file

Binary file not shown.

View File

@ -2,7 +2,7 @@ from __future__ import print_function
# minimal test runner
import glob, os, sys
import glob, os, os.path, sys, tempfile
try:
root = os.path.dirname(__file__)
@ -73,7 +73,8 @@ for file in files:
print("-"*68)
tempfiles = glob.glob(os.path.join(root, "temp_*"))
temp_root = os.path.join(tempfile.gettempdir(), 'pillow-tests')
tempfiles = glob.glob(os.path.join(temp_root, "temp_*"))
if tempfiles:
print("===", "remaining temporary files")
for file in tempfiles:

View File

@ -0,0 +1,89 @@
from tester import *
from PIL import Image
codecs = dir(Image.core)
if "group4_encoder" not in codecs or "group4_decoder" not in codecs:
skip("tiff support not available")
def _assert_noerr(im):
"""Helper tests that assert basic sanity about the g4 tiff reading"""
#1 bit
assert_equal(im.mode, "1")
# Does the data actually load
assert_no_exception(lambda: im.load())
assert_no_exception(lambda: im.getdata())
try:
assert_equal(im._compression, 'group4')
except:
print("No _compression")
print (dir(im))
# can we write it back out, in a different form.
out = tempfile("temp.png")
assert_no_exception(lambda: im.save(out))
def test_g4_tiff():
"""Test the ordinary file path load path"""
file = "Tests/images/lena_g4_500.tif"
im = Image.open(file)
assert_equal(im.size, (500,500))
_assert_noerr(im)
def test_g4_large():
file = "Tests/images/pport_g4.tif"
im = Image.open(file)
_assert_noerr(im)
def test_g4_tiff_file():
"""Testing the string load path"""
file = "Tests/images/lena_g4_500.tif"
with open(file,'rb') as f:
im = Image.open(f)
assert_equal(im.size, (500,500))
_assert_noerr(im)
def test_g4_tiff_bytesio():
"""Testing the stringio loading code path"""
from io import BytesIO
file = "Tests/images/lena_g4_500.tif"
s = BytesIO()
with open(file,'rb') as f:
s.write(f.read())
s.seek(0)
im = Image.open(s)
assert_equal(im.size, (500,500))
_assert_noerr(im)
def test_g4_eq_png():
""" Checking that we're actually getting the data that we expect"""
png = Image.open('Tests/images/lena_bw_500.png')
g4 = Image.open('Tests/images/lena_g4_500.tif')
assert_image_equal(g4, png)
def test_g4_write():
"""Checking to see that the saved image is the same as what we wrote"""
file = "Tests/images/lena_g4_500.tif"
orig = Image.open(file)
out = tempfile("temp.tif")
rot = orig.transpose(Image.ROTATE_90)
assert_equal(rot.size,(500,500))
rot.save(out)
reread = Image.open(out)
assert_equal(reread.size,(500,500))
_assert_noerr(reread)
assert_image_equal(reread, rot)
assert_false(orig.tobytes() == reread.tobytes())

View File

@ -2,8 +2,13 @@ from tester import *
from PIL import Image
from test_file_tiff import _assert_noerr
from test_file_libtiff import _assert_noerr
codecs = dir(Image.core)
if "group4_encoder" not in codecs or "group4_decoder" not in codecs:
skip("tiff support not available")
""" The small lena image was failing on open in the libtiff
decoder because the file pointer was set to the wrong place
by a spurious seek. It wasn't failing with the byteio method.

View File

@ -2,21 +2,27 @@ from tester import *
from PIL import Image, TarIO
codecs = dir(Image.core)
if "zip_decoder" not in codecs and "jpeg_decoder" not in codecs:
skip("neither jpeg nor zip support not available")
# sample ppm stream
tarfile = "Images/lena.tar"
def test_sanity():
tar = TarIO.TarIO(tarfile, 'lena.png')
im = Image.open(tar)
im.load()
assert_equal(im.mode, "RGB")
assert_equal(im.size, (128, 128))
assert_equal(im.format, "PNG")
if "zip_decoder" in codecs:
tar = TarIO.TarIO(tarfile, 'lena.png')
im = Image.open(tar)
im.load()
assert_equal(im.mode, "RGB")
assert_equal(im.size, (128, 128))
assert_equal(im.format, "PNG")
tar = TarIO.TarIO(tarfile, 'lena.jpg')
im = Image.open(tar)
im.load()
assert_equal(im.mode, "RGB")
assert_equal(im.size, (128, 128))
assert_equal(im.format, "JPEG")
if "jpeg_decoder" in codecs:
tar = TarIO.TarIO(tarfile, 'lena.jpg')
im = Image.open(tar)
im.load()
assert_equal(im.mode, "RGB")
assert_equal(im.size, (128, 128))
assert_equal(im.format, "JPEG")

View File

@ -2,8 +2,6 @@ from tester import *
from PIL import Image
import random
def test_sanity():
file = tempfile("temp.tif")
@ -45,6 +43,10 @@ def test_mac_tiff():
def test_gimp_tiff():
# Read TIFF JPEG images from GIMP [@PIL168]
codecs = dir(Image.core)
if "jpeg_decoder" not in codecs:
skip("jpeg support not available")
file = "Tests/images/pil168.tif"
im = Image.open(file)
@ -58,83 +60,14 @@ def test_gimp_tiff():
])
assert_no_exception(lambda: im.load())
def _assert_noerr(im):
"""Helper tests that assert basic sanity about the g4 tiff reading"""
#1 bit
assert_equal(im.mode, "1")
# Does the data actually load
assert_no_exception(lambda: im.load())
assert_no_exception(lambda: im.getdata())
try:
assert_equal(im._compression, 'group4')
except:
print("No _compression")
print (dir(im))
# can we write it back out, in a different form.
out = tempfile("temp.png")
assert_no_exception(lambda: im.save(out))
def test_g4_tiff():
"""Test the ordinary file path load path"""
file = "Tests/images/lena_g4_500.tif"
def test_xyres_tiff():
from PIL.TiffImagePlugin import X_RESOLUTION, Y_RESOLUTION
file = "Tests/images/pil168.tif"
im = Image.open(file)
assert_equal(im.size, (500,500))
_assert_noerr(im)
def test_g4_large():
file = "Tests/images/pport_g4.tif"
im = Image.open(file)
_assert_noerr(im)
def test_g4_tiff_file():
"""Testing the string load path"""
file = "Tests/images/lena_g4_500.tif"
with open(file,'rb') as f:
im = Image.open(f)
assert_equal(im.size, (500,500))
_assert_noerr(im)
def test_g4_tiff_bytesio():
"""Testing the stringio loading code path"""
from io import BytesIO
file = "Tests/images/lena_g4_500.tif"
s = BytesIO()
with open(file,'rb') as f:
s.write(f.read())
s.seek(0)
im = Image.open(s)
assert_equal(im.size, (500,500))
_assert_noerr(im)
def test_g4_eq_png():
""" Checking that we're actually getting the data that we expect"""
png = Image.open('Tests/images/lena_bw_500.png')
g4 = Image.open('Tests/images/lena_g4_500.tif')
assert_image_equal(g4, png)
def test_g4_write():
"""Checking to see that the saved image is the same as what we wrote"""
file = "Tests/images/lena_g4_500.tif"
orig = Image.open(file)
out = tempfile("temp.tif")
rot = orig.transpose(Image.ROTATE_90)
assert_equal(rot.size,(500,500))
rot.save(out)
reread = Image.open(out)
assert_equal(reread.size,(500,500))
_assert_noerr(reread)
assert_image_equal(reread, rot)
assert_false(orig.tobytes() == reread.tobytes())
assert isinstance(im.tag.tags[X_RESOLUTION][0], tuple)
assert isinstance(im.tag.tags[Y_RESOLUTION][0], tuple)
#Try to read a file where X,Y_RESOLUTION are ints
im.tag.tags[X_RESOLUTION] = (72,)
im.tag.tags[Y_RESOLUTION] = (72,)
im._setup()
assert_equal(im.info['dpi'], (72., 72.))

View File

@ -3,6 +3,11 @@ from tester import *
from PIL import Image, FontFile, PcfFontFile
from PIL import ImageFont, ImageDraw
codecs = dir(Image.core)
if "zip_encoder" not in codecs or "zip_decoder" not in codecs:
skip("zlib support not available")
fontname = "Tests/fonts/helvO18.pcf"
tempname = tempfile("temp.pil", "temp.pbm")

View File

@ -2,6 +2,11 @@ from tester import *
from PIL import Image
codecs = dir(Image.core)
if "jpeg_encoder" not in codecs or "jpeg_decoder" not in codecs:
skip("jpeg support not available")
filename = "Images/lena.jpg"
data = tostring(Image.open(filename).resize((512, 512)), "JPEG")

View File

@ -30,7 +30,13 @@ def test_split_merge():
assert_image_equal(lena("YCbCr"), split_merge("YCbCr"))
def test_split_open():
file = tempfile("temp.png")
codecs = dir(Image.core)
if 'zip_encoder' in codecs:
file = tempfile("temp.png")
else:
file = tempfile("temp.pcx")
def split_open(mode):
lena(mode).save(file)
im = Image.open(file)
@ -39,4 +45,5 @@ def test_split_open():
assert_equal(split_open("L"), 1)
assert_equal(split_open("P"), 1)
assert_equal(split_open("RGB"), 3)
assert_equal(split_open("RGBA"), 4)
if 'zip_encoder' in codecs:
assert_equal(split_open("RGBA"), 4)

View File

@ -3,6 +3,8 @@ from tester import *
from PIL import Image
from PIL import ImageFile
codecs = dir(Image.core)
# save original block sizes
MAXBLOCK = ImageFile.MAXBLOCK
SAFEBLOCK = ImageFile.SAFEBLOCK
@ -31,12 +33,13 @@ def test_parser():
assert_image_equal(*roundtrip("GIF"))
assert_image_equal(*roundtrip("IM"))
assert_image_equal(*roundtrip("MSP"))
try:
# force multiple blocks in PNG driver
ImageFile.MAXBLOCK = 8192
assert_image_equal(*roundtrip("PNG"))
finally:
ImageFile.MAXBLOCK = MAXBLOCK
if "zip_encoder" in codecs:
try:
# force multiple blocks in PNG driver
ImageFile.MAXBLOCK = 8192
assert_image_equal(*roundtrip("PNG"))
finally:
ImageFile.MAXBLOCK = MAXBLOCK
assert_image_equal(*roundtrip("PPM"))
assert_image_equal(*roundtrip("TIFF"))
assert_image_equal(*roundtrip("XBM"))
@ -44,8 +47,9 @@ def test_parser():
assert_image_equal(*roundtrip("TGA"))
assert_image_equal(*roundtrip("PCX"))
im1, im2 = roundtrip("JPEG") # lossy compression
assert_image(im1, im2.mode, im2.size)
if "jpeg_encoder" in codecs:
im1, im2 = roundtrip("JPEG") # lossy compression
assert_image(im1, im2.mode, im2.size)
# XXX Why assert exception and why does it fail?
# https://github.com/python-imaging/Pillow/issues/78
@ -55,6 +59,9 @@ def test_safeblock():
im1 = lena()
if "zip_encoder" not in codecs:
skip("PNG (zlib) encoder not available")
try:
ImageFile.SAFEBLOCK = 1
im2 = fromstring(tostring(im1, "PNG"))

View File

@ -1,12 +1,61 @@
from tester import *
from PIL import Image
from io import BytesIO
try:
from PIL import ImageFont
ImageFont.core.getfont # check if freetype is available
except ImportError:
skip()
def test_sanity():
from PIL import ImageDraw
font_path = "Tests/fonts/FreeMono.ttf"
font_size=20
def test_sanity():
assert_match(ImageFont.core.freetype2_version, "\d+\.\d+\.\d+$")
def test_font_with_name():
assert_no_exception(lambda: ImageFont.truetype(font_path, font_size))
assert_no_exception(lambda: _render(font_path))
def _font_as_bytes():
with open(font_path, 'rb') as f:
font_bytes = BytesIO(f.read())
return font_bytes
def test_font_with_filelike():
assert_no_exception(lambda: ImageFont.truetype(_font_as_bytes(), font_size))
assert_no_exception(lambda: _render(_font_as_bytes()))
# Usage note: making two fonts from the same buffer fails.
#shared_bytes = _font_as_bytes()
#assert_no_exception(lambda: _render(shared_bytes))
#assert_exception(Exception, lambda: _render(shared_bytes))
def test_font_with_open_file():
with open(font_path, 'rb') as f:
assert_no_exception(lambda: _render(f))
def test_font_old_parameters():
assert_warning(DeprecationWarning, lambda: ImageFont.truetype(filename=font_path, size=font_size))
def _render(font):
txt = "Hello World!"
ttf = ImageFont.truetype(font, font_size)
w, h = ttf.getsize(txt)
img = Image.new("RGB", (256, 64), "white")
d = ImageDraw.Draw(img)
d.text((10, 10), txt, font=ttf, fill='black')
img.save('font.png')
return img
def test_render_equal():
img_path = _render(font_path)
with open(font_path, 'rb') as f:
font_filelike = BytesIO(f.read())
img_filelike = _render(font_filelike)
assert_image_equal(img_path, img_filelike)

View File

@ -41,7 +41,10 @@ def test_numpy_to_image():
assert_exception(TypeError, lambda: to_image(numpy.uint64))
assert_image(to_image(numpy.int8), "I", (10, 10))
assert_image(to_image(numpy.int16), "I;16", (10, 10))
if Image._ENDIAN == '<': # Little endian
assert_image(to_image(numpy.int16), "I;16", (10, 10))
else:
assert_image(to_image(numpy.int16), "I;16B", (10, 10))
assert_image(to_image(numpy.int32), "I", (10, 10))
assert_exception(TypeError, lambda: to_image(numpy.int64))

View File

@ -171,11 +171,16 @@ def assert_image_similar(a, b, epsilon, msg=None):
success()
def tempfile(template, *extra):
import os, sys
import os, os.path, sys, tempfile
files = []
root = os.path.join(tempfile.gettempdir(), 'pillow-tests')
try:
os.mkdir(root)
except OSError:
pass
for temp in (template,) + extra:
assert temp[:5] in ("temp.", "temp_")
root, name = os.path.split(sys.argv[0])
name = os.path.basename(sys.argv[0])
name = temp[:4] + os.path.splitext(name)[0][4:]
name = name + "_%d" % len(_tempfiles) + temp[4:]
name = os.path.join(root, name)
@ -229,12 +234,18 @@ def _setup():
if success.count and not failure.count:
print("ok")
# only clean out tempfiles if test passed
import os
import os, os.path, tempfile
for file in _tempfiles:
try:
os.remove(file)
except OSError:
pass # report?
temp_root = os.path.join(tempfile.gettempdir(), 'pillow-tests')
try:
os.rmdir(temp_root)
except OSError:
pass
if "--coverage" in sys.argv:
import coverage
coverage.stop()

View File

@ -48,9 +48,8 @@
for the Tcl_CreateCommand command. */
#define USE_COMPAT_CONST
#include "tk.h"
#include "Imaging.h"
#include "tk.h"
#include <stdlib.h>

View File

@ -35,6 +35,8 @@
#include <freetype/freetype.h>
#endif
#include FT_GLYPH_H
#define KEEP_PY_UNICODE
#include "py3.h"
@ -97,17 +99,20 @@ getfont(PyObject* self_, PyObject* args, PyObject* kw)
FontObject* self;
int error;
char* filename;
char* filename = NULL;
int size;
int index = 0;
unsigned char* encoding = NULL;
unsigned char* encoding;
unsigned char* font_bytes;
int font_bytes_size = 0;
static char* kwlist[] = {
"filename", "size", "index", "encoding", NULL
"filename", "size", "index", "encoding", "font_bytes", NULL
};
if (!PyArg_ParseTupleAndKeywords(args, kw, "eti|is", kwlist,
if (!PyArg_ParseTupleAndKeywords(args, kw, "eti|iss#", kwlist,
Py_FileSystemDefaultEncoding, &filename,
&size, &index, &encoding))
&size, &index, &encoding, &font_bytes,
&font_bytes_size))
return NULL;
if (!library) {
@ -122,8 +127,12 @@ getfont(PyObject* self_, PyObject* args, PyObject* kw)
if (!self)
return NULL;
error = FT_New_Face(library, filename, index, &self->face);
if (filename && font_bytes_size <= 0) {
error = FT_New_Face(library, filename, index, &self->face);
} else {
error = FT_New_Memory_Face(library, (FT_Byte*)font_bytes, font_bytes_size, index, &self->face);
}
if (!error)
error = FT_Set_Pixel_Sizes(self->face, 0, size);
@ -141,7 +150,7 @@ getfont(PyObject* self_, PyObject* args, PyObject* kw)
return (PyObject*) self;
}
static int
font_getchar(PyObject* string, int index, FT_ULong* char_out)
{
@ -171,7 +180,7 @@ font_getchar(PyObject* string, int index, FT_ULong* char_out)
static PyObject*
font_getsize(FontObject* self, PyObject* args)
{
int i, x;
int i, x, y_max, y_min;
FT_ULong ch;
FT_Face face;
int xoffset;
@ -195,6 +204,7 @@ font_getsize(FontObject* self, PyObject* args)
face = NULL;
xoffset = 0;
y_max = y_min = 0;
for (x = i = 0; font_getchar(string, i, &ch); i++) {
int index, error;
@ -212,6 +222,16 @@ font_getsize(FontObject* self, PyObject* args)
if (i == 0)
xoffset = face->glyph->metrics.horiBearingX;
x += face->glyph->metrics.horiAdvance;
FT_BBox bbox;
FT_Glyph glyph;
FT_Get_Glyph(face->glyph, &glyph);
FT_Glyph_Get_CBox(glyph, FT_GLYPH_BBOX_SUBPIXELS, &bbox);
if (bbox.yMax > y_max)
y_max = bbox.yMax;
if (bbox.yMin < y_min)
y_min = bbox.yMin;
last_index = index;
}
@ -232,7 +252,7 @@ font_getsize(FontObject* self, PyObject* args)
return Py_BuildValue(
"(ii)(ii)",
PIXEL(x), PIXEL(self->face->size->metrics.height),
PIXEL(x), PIXEL(y_max - y_min),
PIXEL(xoffset), 0
);
}
@ -282,7 +302,7 @@ font_render(FontObject* self, PyObject* args)
{
int i, x, y;
Imaging im;
int index, error, ascender, descender;
int index, error, ascender;
int load_flags;
unsigned char *source;
FT_ULong ch;
@ -313,6 +333,19 @@ font_render(FontObject* self, PyObject* args)
if (mask)
load_flags |= FT_LOAD_TARGET_MONO;
int temp;
ascender = 0;
for (i = 0; font_getchar(string, i, &ch); i++) {
index = FT_Get_Char_Index(self->face, ch);
error = FT_Load_Glyph(self->face, index, load_flags);
if (error)
return geterror(error);
glyph = self->face->glyph;
temp = (glyph->bitmap.rows - glyph->bitmap_top);
if (temp > ascender)
ascender = temp;
}
for (x = i = 0; font_getchar(string, i, &ch); i++) {
if (i == 0 && self->face->glyph->metrics.horiBearingX < 0)
x = -PIXEL(self->face->glyph->metrics.horiBearingX);
@ -323,25 +356,27 @@ font_render(FontObject* self, PyObject* args)
&delta);
x += delta.x >> 6;
}
error = FT_Load_Glyph(self->face, index, load_flags);
if (error)
return geterror(error);
glyph = self->face->glyph;
int xx, x0, x1;
source = (unsigned char*) glyph->bitmap.buffer;
xx = x + glyph->bitmap_left;
x0 = 0;
x1 = glyph->bitmap.width;
if (xx < 0)
x0 = -xx;
if (xx + x1 > im->xsize)
x1 = im->xsize - xx;
if (mask) {
/* use monochrome mask (on palette images, etc) */
int xx, x0, x1;
source = (unsigned char*) glyph->bitmap.buffer;
ascender = PIXEL(self->face->size->metrics.ascender);
descender = PIXEL(self->face->size->metrics.descender);
xx = x + glyph->bitmap_left;
x0 = 0;
x1 = glyph->bitmap.width;
if (xx < 0)
x0 = -xx;
if (xx + x1 > im->xsize)
x1 = im->xsize - xx;
for (y = 0; y < glyph->bitmap.rows; y++) {
int yy = y + ascender + descender - glyph->bitmap_top;
int yy = y + im->ysize - (PIXEL(glyph->metrics.horiBearingY) + ascender);
if (yy >= 0 && yy < im->ysize) {
/* blend this glyph into the buffer */
unsigned char *target = im->image8[yy] + xx;
@ -359,19 +394,8 @@ font_render(FontObject* self, PyObject* args)
}
} else {
/* use antialiased rendering */
int xx, x0, x1;
source = (unsigned char*) glyph->bitmap.buffer;
ascender = PIXEL(self->face->size->metrics.ascender);
descender = PIXEL(self->face->size->metrics.descender);
xx = x + glyph->bitmap_left;
x0 = 0;
x1 = glyph->bitmap.width;
if (xx < 0)
x0 = -xx;
if (xx + x1 > im->xsize)
x1 = im->xsize - xx;
for (y = 0; y < glyph->bitmap.rows; y++) {
int yy = y + ascender + descender - glyph->bitmap_top;
int yy = y + im->ysize - (PIXEL(glyph->metrics.horiBearingY) + ascender);
if (yy >= 0 && yy < im->ysize) {
/* blend this glyph into the buffer */
int i;

14
_webp.c
View File

@ -20,7 +20,7 @@ PyObject* WebPEncodeRGB_wrapper(PyObject* self, PyObject* args)
return Py_None;
}
PyBytes_AsStringAndSize((PyObject *) rgb_string, &rgb, &size);
PyBytes_AsStringAndSize((PyObject *) rgb_string, (char**)&rgb, &size);
if (stride * height > size) {
Py_INCREF(Py_None);
@ -29,7 +29,7 @@ PyObject* WebPEncodeRGB_wrapper(PyObject* self, PyObject* args)
ret_size = WebPEncodeRGB(rgb, width, height, stride, quality_factor, &output);
if (ret_size > 0) {
PyObject *ret = PyBytes_FromStringAndSize(output, ret_size);
PyObject *ret = PyBytes_FromStringAndSize((char*)output, ret_size);
free(output);
return ret;
}
@ -41,7 +41,6 @@ PyObject* WebPEncodeRGB_wrapper(PyObject* self, PyObject* args)
PyObject* WebPDecodeRGB_wrapper(PyObject* self, PyObject* args)
{
PyBytesObject *webp_string;
float quality_factor;
int width;
int height;
uint8_t *webp;
@ -54,11 +53,11 @@ PyObject* WebPDecodeRGB_wrapper(PyObject* self, PyObject* args)
return Py_None;
}
PyBytes_AsStringAndSize((PyObject *) webp_string, &webp, &size);
PyBytes_AsStringAndSize((PyObject *) webp_string, (char**)&webp, &size);
output = WebPDecodeRGB(webp, size, &width, &height);
ret = PyBytes_FromStringAndSize(output, width * height * 3);
ret = PyBytes_FromStringAndSize((char*)output, width * height * 3);
free(output);
return Py_BuildValue("Sii", ret, width, height);
}
@ -88,9 +87,8 @@ PyInit__webp(void) {
}
#else
PyMODINIT_FUNC
init_webp()
init_webp(void)
{
PyObject* m;
m = Py_InitModule("_webp", webpMethods);
Py_InitModule("_webp", webpMethods);
}
#endif

View File

@ -1,6 +1,9 @@
Changelog (Pillow)
==================
2.1.0 (2013-07-01)
------------------
2.0.0 (2013-03-15)
------------------

View File

@ -77,17 +77,17 @@ qthelp:
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Pillowdocumentation.qhcp"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PillowPILfork.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Pillowdocumentation.qhc"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PillowPILfork.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/Pillowdocumentation"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Pillowdocumentation"
@echo "# mkdir -p $$HOME/.local/share/devhelp/PillowPILfork"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PillowPILfork"
@echo "# devhelp"
epub:

651
docs/PIL.rst Normal file
View File

@ -0,0 +1,651 @@
PIL Package
===========
:mod:`PIL` Package
------------------
.. automodule:: PIL.__init__
:members:
:undoc-members:
:show-inheritance:
:mod:`ArgImagePlugin` Module
----------------------------
.. automodule:: PIL.ArgImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`BdfFontFile` Module
-------------------------
.. automodule:: PIL.BdfFontFile
:members:
:undoc-members:
:show-inheritance:
:mod:`BmpImagePlugin` Module
----------------------------
.. automodule:: PIL.BmpImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`BufrStubImagePlugin` Module
---------------------------------
.. automodule:: PIL.BufrStubImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`ContainerIO` Module
-------------------------
.. automodule:: PIL.ContainerIO
:members:
:undoc-members:
:show-inheritance:
:mod:`CurImagePlugin` Module
----------------------------
.. automodule:: PIL.CurImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`DcxImagePlugin` Module
----------------------------
.. automodule:: PIL.DcxImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`EpsImagePlugin` Module
----------------------------
.. automodule:: PIL.EpsImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`ExifTags` Module
----------------------
.. automodule:: PIL.ExifTags
:members:
:undoc-members:
:show-inheritance:
:mod:`FitsStubImagePlugin` Module
---------------------------------
.. automodule:: PIL.FitsStubImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`FliImagePlugin` Module
----------------------------
.. automodule:: PIL.FliImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`FontFile` Module
----------------------
.. automodule:: PIL.FontFile
:members:
:undoc-members:
:show-inheritance:
:mod:`FpxImagePlugin` Module
----------------------------
.. automodule:: PIL.FpxImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`GbrImagePlugin` Module
----------------------------
.. automodule:: PIL.GbrImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`GdImageFile` Module
-------------------------
.. automodule:: PIL.GdImageFile
:members:
:undoc-members:
:show-inheritance:
:mod:`GifImagePlugin` Module
----------------------------
.. automodule:: PIL.GifImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`GimpGradientFile` Module
------------------------------
.. automodule:: PIL.GimpGradientFile
:members:
:undoc-members:
:show-inheritance:
:mod:`GimpPaletteFile` Module
-----------------------------
.. automodule:: PIL.GimpPaletteFile
:members:
:undoc-members:
:show-inheritance:
:mod:`GribStubImagePlugin` Module
---------------------------------
.. automodule:: PIL.GribStubImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`Hdf5StubImagePlugin` Module
---------------------------------
.. automodule:: PIL.Hdf5StubImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`IcnsImagePlugin` Module
-----------------------------
.. automodule:: PIL.IcnsImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`IcoImagePlugin` Module
----------------------------
.. automodule:: PIL.IcoImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`ImImagePlugin` Module
---------------------------
.. automodule:: PIL.ImImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`Image` Module
-------------------
.. automodule:: PIL.Image
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageChops` Module
------------------------
.. automodule:: PIL.ImageChops
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageCms` Module
----------------------
.. automodule:: PIL.ImageCms
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageColor` Module
------------------------
.. automodule:: PIL.ImageColor
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageDraw` Module
-----------------------
.. automodule:: PIL.ImageDraw
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageDraw2` Module
------------------------
.. automodule:: PIL.ImageDraw2
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageEnhance` Module
--------------------------
.. automodule:: PIL.ImageEnhance
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageFile` Module
-----------------------
.. automodule:: PIL.ImageFile
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageFileIO` Module
-------------------------
.. automodule:: PIL.ImageFileIO
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageFilter` Module
-------------------------
.. automodule:: PIL.ImageFilter
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageFont` Module
-----------------------
.. automodule:: PIL.ImageFont
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageMath` Module
-----------------------
.. automodule:: PIL.ImageMath
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageMode` Module
-----------------------
.. automodule:: PIL.ImageMode
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageOps` Module
----------------------
.. automodule:: PIL.ImageOps
:members:
:undoc-members:
:show-inheritance:
:mod:`ImagePalette` Module
--------------------------
.. automodule:: PIL.ImagePalette
:members:
:undoc-members:
:show-inheritance:
:mod:`ImagePath` Module
-----------------------
.. automodule:: PIL.ImagePath
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageQt` Module
---------------------
.. automodule:: PIL.ImageQt
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageSequence` Module
---------------------------
.. automodule:: PIL.ImageSequence
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageShow` Module
-----------------------
.. automodule:: PIL.ImageShow
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageStat` Module
-----------------------
.. automodule:: PIL.ImageStat
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageTk` Module
---------------------
.. automodule:: PIL.ImageTk
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageTransform` Module
----------------------------
.. automodule:: PIL.ImageTransform
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageWin` Module
----------------------
.. automodule:: PIL.ImageWin
:members:
:undoc-members:
:show-inheritance:
:mod:`ImtImagePlugin` Module
----------------------------
.. automodule:: PIL.ImtImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`IptcImagePlugin` Module
-----------------------------
.. automodule:: PIL.IptcImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`JpegImagePlugin` Module
-----------------------------
.. automodule:: PIL.JpegImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`JpegPresets` Module
-------------------------
.. automodule:: PIL.JpegPresets
:members:
:undoc-members:
:show-inheritance:
:mod:`McIdasImagePlugin` Module
-------------------------------
.. automodule:: PIL.McIdasImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`MicImagePlugin` Module
----------------------------
.. automodule:: PIL.MicImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`MpegImagePlugin` Module
-----------------------------
.. automodule:: PIL.MpegImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`MspImagePlugin` Module
----------------------------
.. automodule:: PIL.MspImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`OleFileIO` Module
-----------------------
.. automodule:: PIL.OleFileIO
:members:
:undoc-members:
:show-inheritance:
:mod:`PSDraw` Module
--------------------
.. automodule:: PIL.PSDraw
:members:
:undoc-members:
:show-inheritance:
:mod:`PaletteFile` Module
-------------------------
.. automodule:: PIL.PaletteFile
:members:
:undoc-members:
:show-inheritance:
:mod:`PalmImagePlugin` Module
-----------------------------
.. automodule:: PIL.PalmImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`PcdImagePlugin` Module
----------------------------
.. automodule:: PIL.PcdImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`PcfFontFile` Module
-------------------------
.. automodule:: PIL.PcfFontFile
:members:
:undoc-members:
:show-inheritance:
:mod:`PcxImagePlugin` Module
----------------------------
.. automodule:: PIL.PcxImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`PdfImagePlugin` Module
----------------------------
.. automodule:: PIL.PdfImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`PixarImagePlugin` Module
------------------------------
.. automodule:: PIL.PixarImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`PngImagePlugin` Module
----------------------------
.. automodule:: PIL.PngImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`PpmImagePlugin` Module
----------------------------
.. automodule:: PIL.PpmImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`PsdImagePlugin` Module
----------------------------
.. automodule:: PIL.PsdImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`SgiImagePlugin` Module
----------------------------
.. automodule:: PIL.SgiImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`SpiderImagePlugin` Module
-------------------------------
.. automodule:: PIL.SpiderImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`SunImagePlugin` Module
----------------------------
.. automodule:: PIL.SunImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`TarIO` Module
-------------------
.. automodule:: PIL.TarIO
:members:
:undoc-members:
:show-inheritance:
:mod:`TgaImagePlugin` Module
----------------------------
.. automodule:: PIL.TgaImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`TiffImagePlugin` Module
-----------------------------
.. automodule:: PIL.TiffImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`TiffTags` Module
----------------------
.. automodule:: PIL.TiffTags
:members:
:undoc-members:
:show-inheritance:
:mod:`WalImageFile` Module
--------------------------
.. automodule:: PIL.WalImageFile
:members:
:undoc-members:
:show-inheritance:
:mod:`WebPImagePlugin` Module
-----------------------------
.. automodule:: PIL.WebPImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`WmfImagePlugin` Module
----------------------------
.. automodule:: PIL.WmfImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`XVThumbImagePlugin` Module
--------------------------------
.. automodule:: PIL.XVThumbImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`XbmImagePlugin` Module
----------------------------
.. automodule:: PIL.XbmImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`XpmImagePlugin` Module
----------------------------
.. automodule:: PIL.XpmImagePlugin
:members:
:undoc-members:
:show-inheritance:
:mod:`_binary` Module
---------------------
.. automodule:: PIL._binary
:members:
:undoc-members:
:show-inheritance:

1
docs/_build/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
# Empty file, to make the directory available in the repository

1
docs/_static/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
# Empty file, to make the directory available in the repository

1
docs/_templates/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
# Empty file, to make the directory available in the repository

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# Pillow documentation documentation build configuration file, created by
# sphinx-quickstart on Thu Feb 16 20:04:11 2012.
# Pillow (PIL fork) documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 12 19:51:26 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
@ -16,7 +16,7 @@ import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../'))
# -- General configuration -----------------------------------------------------
@ -25,7 +25,7 @@ import sys, os
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = []
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@ -41,7 +41,7 @@ master_doc = 'index'
# General information about the project.
project = u'Pillow (PIL fork)'
copyright = u'Copyright © 1997-2011 by Secret Labs AB Copyright © 1995-2011 by Fredrik Lundh'
copyright = u'1997-2011 by Secret Labs AB, 1995-2011 by Fredrik Lundh, 2010-2013 Alex Clark'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@ -164,7 +164,7 @@ html_static_path = ['_static']
#html_file_suffix = None
# Output file base name for HTML help builder.
#htmlhelp_basename = None
htmlhelp_basename = 'PillowPILforkdoc'
# -- Options for LaTeX output --------------------------------------------------
@ -183,6 +183,8 @@ latex_elements = {
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'PillowPILfork.tex', u'Pillow (PIL fork) Documentation',
u'Author', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@ -211,6 +213,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'pillowpilfork', u'Pillow (PIL fork) Documentation',
[u'Author'], 1)
]
# If true, show URL addresses after external links.
@ -223,6 +227,9 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'PillowPILfork', u'Pillow (PIL fork) Documentation',
u'Author', 'PillowPILfork', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
@ -233,3 +240,46 @@ texinfo_documents = [
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# -- Options for Epub output ---------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = u'Pillow (PIL fork)'
epub_author = u'Author'
epub_publisher = u'Author'
epub_copyright = u'2013, Author'
# The language of the text. It defaults to the language option
# or en if the language is not set.
#epub_language = ''
# The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = ''
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#epub_identifier = ''
# A unique identification for the text.
#epub_uid = ''
# A tuple containing the cover image and cover page html template filenames.
#epub_cover = ()
# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_pre_files = []
# HTML files shat should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_post_files = []
# A list of files that should not be packed into the epub file.
#epub_exclude_files = []
# The depth of the table of contents in toc.ncx.
#epub_tocdepth = 3
# Allow duplicate toc entries.
#epub_tocdup = True

View File

@ -1,118 +0,0 @@
/* effbot.css */
BODY {
font: 100% Georgia, Times, serif;
color: black;
margin: 0px 20px 0px 20px;
}
#effbot-body {
background: white;
padding: 10px 40px 10px 40px;
max-width: 50em;
}
#effbot-menu {
display: none;
}
.adsense {
background: #f8fff8;
border: 1px solid #084;
padding: 10px 4px 4px 4px;
}
.sidebar {
border: 1px solid #000;
float: right; clear: right;
width: 200px;
background: white;
padding: 10px;
margin: 0px -25px 10px 0px;
}
/* visual style */
P {
line-height: 1.3em;
}
CODE, PRE {
font: 100% "Courier New", Courier, Monaco, monospace;
color: #042; margin-left: 20px;
}
H1, H2, H3 {
font-family: Georgia, Times, serif;
color: #084; margin-top: 30px;
}
H1, H2, { border-top: 1px solid #084; }
H4, H5, H6 {
font-family: Georgia, Times, serif;
color: #084; margin-top: 15px;
}
A:link, A:hover { color: #084; }
A:visited { color: #404040; }
UL LI { list-style-type: square; }
.title { margin-bottom: 2px; color: #084; }
.info { font-size: 80%; color: #084; margin-top: 0px; }
.bluebox { color: #084; margin-top: 10px; }
.highlight { background: #cfc; }
.mark { color: #084; }
.small { font-size: 80%; }
.display { background: #eee; padding: 20px; }
.note {
background: #efe;
border-top: 1px solid #084;
border-bottom: 1px solid #084;
padding: 2px 20px;
}
.example {
border-top: medium solid #084;
border-bottom: medium solid #084;
padding: 5px;
}
.figure {
border-top: medium solid #084;
border-bottom: medium solid #084;
padding: 5px;
}
.fixme {
background: #eee;
border: 1px solid #084;
padding: 2x 20px;
}
.simpletable {
border: 1px solid #084;
border-collapse: collapse;
}
.simpletable TH {
text-align: left;
background: #cfc;
border: 1px solid #084;
margin: 0px;
padding: 1px 5px;
}
.simpletable TD {
border: 1px solid #084;
margin: 0px;
padding: 5px;
}
/* xmldiff markup */
.new { text-decoration: underline; color: red; background: #fff0f0; }
.old { text-decoration: line-through; color: blue; background: #f0f0ff; }

View File

@ -1,180 +1,23 @@
==========================
The Python Imaging Library
==========================
.. Pillow (PIL fork) documentation master file, created by
sphinx-quickstart on Fri Apr 12 19:51:26 2013.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
The Python Imaging Library
==========================
Welcome to Pillow (PIL fork)'s documentation!
=============================================
Online Resources
~~~~~~~~~~~~~~~~
Contents:
`*Python Imaging Library* <http://www.pythonware.com/products/pil>`_
(official product page at `pythonware.com <http://www.pythonware.com>`_)
.. toctree::
:maxdepth: 4
`*Python Imaging Library* <http://effbot.org/zone/pil-index.htm>`_
(development page at `effbot.org <http://effbot.org>`_)
PIL
Package Contents
~~~~~~~~~~~~~~~~
The following pages are generated from
`**pythondoc** <http://effbot.org/zone/pythondoc.htm>`_ markup in the
source files.
Indices and tables
==================
`The PIL.Image Module <pythondoc-PIL.Image.html>`_
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
`The PIL.ImageChops Module <pythondoc-PIL.ImageChops.html>`_
`The PIL.ImageColor Module <pythondoc-PIL.ImageColor.html>`_
`The PIL.ImageDraw Module <pythondoc-PIL.ImageDraw.html>`_
`The PIL.ImageEnhance Module <pythondoc-PIL.ImageEnhance.html>`_
`The PIL.ImageFile Module <pythondoc-PIL.ImageFile.html>`_
`The PIL.ImageFileIO Module <pythondoc-PIL.ImageFileIO.html>`_
`The PIL.ImageFilter Module <pythondoc-PIL.ImageFilter.html>`_
`The PIL.ImageFont Module <pythondoc-PIL.ImageFont.html>`_
`The PIL.ImageGL Module <pythondoc-PIL.ImageGL.html>`_
`The PIL.ImageGrab Module <pythondoc-PIL.ImageGrab.html>`_
`The PIL.ImageMath Module <pythondoc-PIL.ImageMath.html>`_
`The PIL.ImageMode Module <pythondoc-PIL.ImageMode.html>`_
`The PIL.ImageOps Module <pythondoc-PIL.ImageOps.html>`_
`The PIL.ImagePalette Module <pythondoc-PIL.ImagePalette.html>`_
`The PIL.ImagePath Module <pythondoc-PIL.ImagePath.html>`_
`The PIL.ImageQt Module <pythondoc-PIL.ImageQt.html>`_
`The PIL.ImageSequence Module <pythondoc-PIL.ImageSequence.html>`_
`The PIL.ImageStat Module <pythondoc-PIL.ImageStat.html>`_
`The PIL.ImageTk Module <pythondoc-PIL.ImageTk.html>`_
`The PIL.ImageTransform Module <pythondoc-PIL.ImageTransform.html>`_
`The PIL.ImageWin Module <pythondoc-PIL.ImageWin.html>`_
`The PIL.ArgImagePlugin Module <pythondoc-PIL.ArgImagePlugin.html>`_
`The PIL.BdfFontFile Module <pythondoc-PIL.BdfFontFile.html>`_
`The PIL.BmpImagePlugin Module <pythondoc-PIL.BmpImagePlugin.html>`_
`The PIL.BufrStubImagePlugin
Module <pythondoc-PIL.BufrStubImagePlugin.html>`_
`The PIL.ContainerIO Module <pythondoc-PIL.ContainerIO.html>`_
`The PIL.CurImagePlugin Module <pythondoc-PIL.CurImagePlugin.html>`_
`The PIL.DcxImagePlugin Module <pythondoc-PIL.DcxImagePlugin.html>`_
`The PIL.EpsImagePlugin Module <pythondoc-PIL.EpsImagePlugin.html>`_
`The PIL.ExifTags Module <pythondoc-PIL.ExifTags.html>`_
`The PIL.FitsStubImagePlugin
Module <pythondoc-PIL.FitsStubImagePlugin.html>`_
`The PIL.FliImagePlugin Module <pythondoc-PIL.FliImagePlugin.html>`_
`The PIL.FontFile Module <pythondoc-PIL.FontFile.html>`_
`The PIL.FpxImagePlugin Module <pythondoc-PIL.FpxImagePlugin.html>`_
`The PIL.GbrImagePlugin Module <pythondoc-PIL.GbrImagePlugin.html>`_
`The PIL.GdImageFile Module <pythondoc-PIL.GdImageFile.html>`_
`The PIL.GifImagePlugin Module <pythondoc-PIL.GifImagePlugin.html>`_
`The PIL.GimpGradientFile Module <pythondoc-PIL.GimpGradientFile.html>`_
`The PIL.GimpPaletteFile Module <pythondoc-PIL.GimpPaletteFile.html>`_
`The PIL.GribStubImagePlugin
Module <pythondoc-PIL.GribStubImagePlugin.html>`_
`The PIL.Hdf5StubImagePlugin
Module <pythondoc-PIL.Hdf5StubImagePlugin.html>`_
`The PIL.IcnsImagePlugin Module <pythondoc-PIL.IcnsImagePlugin.html>`_
`The PIL.IcoImagePlugin Module <pythondoc-PIL.IcoImagePlugin.html>`_
`The PIL.ImImagePlugin Module <pythondoc-PIL.ImImagePlugin.html>`_
`The PIL.ImtImagePlugin Module <pythondoc-PIL.ImtImagePlugin.html>`_
`The PIL.IptcImagePlugin Module <pythondoc-PIL.IptcImagePlugin.html>`_
`The PIL.JpegImagePlugin Module <pythondoc-PIL.JpegImagePlugin.html>`_
`The PIL.McIdasImagePlugin
Module <pythondoc-PIL.McIdasImagePlugin.html>`_
`The PIL.MicImagePlugin Module <pythondoc-PIL.MicImagePlugin.html>`_
`The PIL.MpegImagePlugin Module <pythondoc-PIL.MpegImagePlugin.html>`_
`The PIL.MspImagePlugin Module <pythondoc-PIL.MspImagePlugin.html>`_
`The PIL.OleFileIO Module <pythondoc-PIL.OleFileIO.html>`_
`The PIL.PSDraw Module <pythondoc-PIL.PSDraw.html>`_
`The PIL.PaletteFile Module <pythondoc-PIL.PaletteFile.html>`_
`The PIL.PalmImagePlugin Module <pythondoc-PIL.PalmImagePlugin.html>`_
`The PIL.PcdImagePlugin Module <pythondoc-PIL.PcdImagePlugin.html>`_
`The PIL.PcfFontFile Module <pythondoc-PIL.PcfFontFile.html>`_
`The PIL.PcxImagePlugin Module <pythondoc-PIL.PcxImagePlugin.html>`_
`The PIL.PdfImagePlugin Module <pythondoc-PIL.PdfImagePlugin.html>`_
`The PIL.PixarImagePlugin Module <pythondoc-PIL.PixarImagePlugin.html>`_
`The PIL.PngImagePlugin Module <pythondoc-PIL.PngImagePlugin.html>`_
`The PIL.PpmImagePlugin Module <pythondoc-PIL.PpmImagePlugin.html>`_
`The PIL.PsdImagePlugin Module <pythondoc-PIL.PsdImagePlugin.html>`_
`The PIL.SgiImagePlugin Module <pythondoc-PIL.SgiImagePlugin.html>`_
`The PIL.SunImagePlugin Module <pythondoc-PIL.SunImagePlugin.html>`_
`The PIL.TarIO Module <pythondoc-PIL.TarIO.html>`_
`The PIL.TgaImagePlugin Module <pythondoc-PIL.TgaImagePlugin.html>`_
`The PIL.TiffImagePlugin Module <pythondoc-PIL.TiffImagePlugin.html>`_
`The PIL.TiffTags Module <pythondoc-PIL.TiffTags.html>`_
`The PIL.WalImageFile Module <pythondoc-PIL.WalImageFile.html>`_
`The PIL.WbmpImagePlugin Module <pythondoc-PIL.WbmpImagePlugin.html>`_
`The PIL.WmfImagePlugin Module <pythondoc-PIL.WmfImagePlugin.html>`_
`The PIL.XVThumbImagePlugin
Module <pythondoc-PIL.XVThumbImagePlugin.html>`_
`The PIL.XbmImagePlugin Module <pythondoc-PIL.XbmImagePlugin.html>`_
`The PIL.XpmImagePlugin Module <pythondoc-PIL.XpmImagePlugin.html>`_

View File

@ -99,9 +99,9 @@ if "%1" == "qthelp" (
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Pillowdocumentation.qhcp
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\PillowPILfork.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Pillowdocumentation.ghc
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\PillowPILfork.ghc
goto end
)

View File

@ -1,17 +0,0 @@
=============================
The PIL.ArgImagePlugin Module
=============================
The PIL.ArgImagePlugin Module
=============================
**ArgImageFile** (class) [`# <#PIL.ArgImagePlugin.ArgImageFile-class>`_]
Image plugin for the experimental Animated Raster Graphics format.
For more information about this class, see `*The ArgImageFile
Class* <#PIL.ArgImagePlugin.ArgImageFile-class>`_.
The ArgImageFile Class
----------------------
**ArgImageFile** (class) [`# <#PIL.ArgImagePlugin.ArgImageFile-class>`_]

View File

@ -1,17 +0,0 @@
==========================
The PIL.BdfFontFile Module
==========================
The PIL.BdfFontFile Module
==========================
**BdfFontFile(fp)** (class) [`# <#PIL.BdfFontFile.BdfFontFile-class>`_]
Font file plugin for the X11 BDF format.
For more information about this class, see `*The BdfFontFile
Class* <#PIL.BdfFontFile.BdfFontFile-class>`_.
The BdfFontFile Class
---------------------
**BdfFontFile(fp)** (class) [`# <#PIL.BdfFontFile.BdfFontFile-class>`_]

View File

@ -1,17 +0,0 @@
=============================
The PIL.BmpImagePlugin Module
=============================
The PIL.BmpImagePlugin Module
=============================
**BmpImageFile** (class) [`# <#PIL.BmpImagePlugin.BmpImageFile-class>`_]
Image plugin for the Windows BMP format.
For more information about this class, see `*The BmpImageFile
Class* <#PIL.BmpImagePlugin.BmpImageFile-class>`_.
The BmpImageFile Class
----------------------
**BmpImageFile** (class) [`# <#PIL.BmpImagePlugin.BmpImageFile-class>`_]

View File

@ -1,12 +0,0 @@
==================================
The PIL.BufrStubImagePlugin Module
==================================
The PIL.BufrStubImagePlugin Module
==================================
**register\_handler(handler)**
[`# <#PIL.BufrStubImagePlugin.register_handler-function>`_]
*handler*

View File

@ -1,51 +0,0 @@
==========================
The PIL.ContainerIO Module
==========================
The PIL.ContainerIO Module
==========================
**ContainerIO(file, offset, length)** (class)
[`# <#PIL.ContainerIO.ContainerIO-class>`_]
A file object that provides read access to a part of an existing
file (for example a TAR file).
For more information about this class, see `*The ContainerIO
Class* <#PIL.ContainerIO.ContainerIO-class>`_.
The ContainerIO Class
---------------------
**ContainerIO(file, offset, length)** (class)
[`# <#PIL.ContainerIO.ContainerIO-class>`_]
**\_\_init\_\_(file, offset, length)**
[`# <#PIL.ContainerIO.ContainerIO.__init__-method>`_]
*file*
*offset*
*length*
**isatty()** [`# <#PIL.ContainerIO.ContainerIO.isatty-method>`_]
**read(bytes=0)** [`# <#PIL.ContainerIO.ContainerIO.read-method>`_]
*bytes*
Returns:
**readline()** [`# <#PIL.ContainerIO.ContainerIO.readline-method>`_]
Returns:
**readlines()** [`# <#PIL.ContainerIO.ContainerIO.readlines-method>`_]
Returns:
**seek(offset, mode=0)**
[`# <#PIL.ContainerIO.ContainerIO.seek-method>`_]
*offset*
*mode*
**tell()** [`# <#PIL.ContainerIO.ContainerIO.tell-method>`_]
Returns:

View File

@ -1,17 +0,0 @@
=============================
The PIL.CurImagePlugin Module
=============================
The PIL.CurImagePlugin Module
=============================
**CurImageFile** (class) [`# <#PIL.CurImagePlugin.CurImageFile-class>`_]
Image plugin for Windows Cursor files.
For more information about this class, see `*The CurImageFile
Class* <#PIL.CurImagePlugin.CurImageFile-class>`_.
The CurImageFile Class
----------------------
**CurImageFile** (class) [`# <#PIL.CurImagePlugin.CurImageFile-class>`_]

View File

@ -1,17 +0,0 @@
=============================
The PIL.DcxImagePlugin Module
=============================
The PIL.DcxImagePlugin Module
=============================
**DcxImageFile** (class) [`# <#PIL.DcxImagePlugin.DcxImageFile-class>`_]
Image plugin for the Intel DCX format.
For more information about this class, see `*The DcxImageFile
Class* <#PIL.DcxImagePlugin.DcxImageFile-class>`_.
The DcxImageFile Class
----------------------
**DcxImageFile** (class) [`# <#PIL.DcxImagePlugin.DcxImageFile-class>`_]

View File

@ -1,17 +0,0 @@
=============================
The PIL.EpsImagePlugin Module
=============================
The PIL.EpsImagePlugin Module
=============================
**EpsImageFile** (class) [`# <#PIL.EpsImagePlugin.EpsImageFile-class>`_]
Image plugin for Encapsulated Postscript.
For more information about this class, see `*The EpsImageFile
Class* <#PIL.EpsImagePlugin.EpsImageFile-class>`_.
The EpsImageFile Class
----------------------
**EpsImageFile** (class) [`# <#PIL.EpsImagePlugin.EpsImageFile-class>`_]

View File

@ -1,12 +0,0 @@
=======================
The PIL.ExifTags Module
=======================
The PIL.ExifTags Module
=======================
Module Contents
---------------
**GPSTAGS** (variable) [`# <#PIL.ExifTags.GPSTAGS-variable>`_]
**TAGS** (variable) [`# <#PIL.ExifTags.TAGS-variable>`_]

View File

@ -1,12 +0,0 @@
==================================
The PIL.FitsStubImagePlugin Module
==================================
The PIL.FitsStubImagePlugin Module
==================================
**register\_handler(handler)**
[`# <#PIL.FitsStubImagePlugin.register_handler-function>`_]
*handler*

View File

@ -1,20 +0,0 @@
=============================
The PIL.FliImagePlugin Module
=============================
The PIL.FliImagePlugin Module
=============================
**FliImageFile** (class) [`# <#PIL.FliImagePlugin.FliImageFile-class>`_]
Image plugin for the FLI/FLC animation format.
For more information about this class, see `*The FliImageFile
Class* <#PIL.FliImagePlugin.FliImageFile-class>`_.
The FliImageFile Class
----------------------
**FliImageFile** (class) [`# <#PIL.FliImagePlugin.FliImageFile-class>`_]
Image plugin for the FLI/FLC animation format. Use the **seek**
method to load individual frames.

View File

@ -1,17 +0,0 @@
=======================
The PIL.FontFile Module
=======================
The PIL.FontFile Module
=======================
**FontFile()** (class) [`# <#PIL.FontFile.FontFile-class>`_]
Base class for raster font file handlers.
For more information about this class, see `*The FontFile
Class* <#PIL.FontFile.FontFile-class>`_.
The FontFile Class
------------------
**FontFile()** (class) [`# <#PIL.FontFile.FontFile-class>`_]

View File

@ -1,17 +0,0 @@
=============================
The PIL.FpxImagePlugin Module
=============================
The PIL.FpxImagePlugin Module
=============================
**FpxImageFile** (class) [`# <#PIL.FpxImagePlugin.FpxImageFile-class>`_]
Image plugin for the FlashPix images.
For more information about this class, see `*The FpxImageFile
Class* <#PIL.FpxImagePlugin.FpxImageFile-class>`_.
The FpxImageFile Class
----------------------
**FpxImageFile** (class) [`# <#PIL.FpxImagePlugin.FpxImageFile-class>`_]

View File

@ -1,17 +0,0 @@
=============================
The PIL.GbrImagePlugin Module
=============================
The PIL.GbrImagePlugin Module
=============================
**GbrImageFile** (class) [`# <#PIL.GbrImagePlugin.GbrImageFile-class>`_]
Image plugin for the GIMP brush format.
For more information about this class, see `*The GbrImageFile
Class* <#PIL.GbrImagePlugin.GbrImageFile-class>`_.
The GbrImageFile Class
----------------------
**GbrImageFile** (class) [`# <#PIL.GbrImagePlugin.GbrImageFile-class>`_]

View File

@ -1,29 +0,0 @@
==========================
The PIL.GdImageFile Module
==========================
The PIL.GdImageFile Module
==========================
**GdImageFile** (class) [`# <#PIL.GdImageFile.GdImageFile-class>`_]
Image plugin for the GD uncompressed format.
For more information about this class, see `*The GdImageFile
Class* <#PIL.GdImageFile.GdImageFile-class>`_.
**open(fp, mode="r")** [`# <#PIL.GdImageFile.open-function>`_]
*filename*
*mode*
Returns:
Raises **IOError**:
The GdImageFile Class
---------------------
**GdImageFile** (class) [`# <#PIL.GdImageFile.GdImageFile-class>`_]
Image plugin for the GD uncompressed format. Note that this format
is not supported by the standard **Image.open** function. To use
this plugin, you have to import the **GdImageFile** module and use
the **GdImageFile.open** function.

View File

@ -1,17 +0,0 @@
=============================
The PIL.GifImagePlugin Module
=============================
The PIL.GifImagePlugin Module
=============================
**GifImageFile** (class) [`# <#PIL.GifImagePlugin.GifImageFile-class>`_]
Image plugin for GIF images.
For more information about this class, see `*The GifImageFile
Class* <#PIL.GifImagePlugin.GifImageFile-class>`_.
The GifImageFile Class
----------------------
**GifImageFile** (class) [`# <#PIL.GifImagePlugin.GifImageFile-class>`_]

View File

@ -1,19 +0,0 @@
===============================
The PIL.GimpGradientFile Module
===============================
The PIL.GimpGradientFile Module
===============================
**GimpGradientFile(fp)** (class)
[`# <#PIL.GimpGradientFile.GimpGradientFile-class>`_]
File handler for GIMP's gradient format.
For more information about this class, see `*The GimpGradientFile
Class* <#PIL.GimpGradientFile.GimpGradientFile-class>`_.
The GimpGradientFile Class
--------------------------
**GimpGradientFile(fp)** (class)
[`# <#PIL.GimpGradientFile.GimpGradientFile-class>`_]

View File

@ -1,19 +0,0 @@
==============================
The PIL.GimpPaletteFile Module
==============================
The PIL.GimpPaletteFile Module
==============================
**GimpPaletteFile(fp)** (class)
[`# <#PIL.GimpPaletteFile.GimpPaletteFile-class>`_]
File handler for GIMP's palette format.
For more information about this class, see `*The GimpPaletteFile
Class* <#PIL.GimpPaletteFile.GimpPaletteFile-class>`_.
The GimpPaletteFile Class
-------------------------
**GimpPaletteFile(fp)** (class)
[`# <#PIL.GimpPaletteFile.GimpPaletteFile-class>`_]

View File

@ -1,12 +0,0 @@
==================================
The PIL.GribStubImagePlugin Module
==================================
The PIL.GribStubImagePlugin Module
==================================
**register\_handler(handler)**
[`# <#PIL.GribStubImagePlugin.register_handler-function>`_]
*handler*

View File

@ -1,12 +0,0 @@
==================================
The PIL.Hdf5StubImagePlugin Module
==================================
The PIL.Hdf5StubImagePlugin Module
==================================
**register\_handler(handler)**
[`# <#PIL.Hdf5StubImagePlugin.register_handler-function>`_]
*handler*

View File

@ -1,19 +0,0 @@
==============================
The PIL.IcnsImagePlugin Module
==============================
The PIL.IcnsImagePlugin Module
==============================
**IcnsImageFile** (class)
[`# <#PIL.IcnsImagePlugin.IcnsImageFile-class>`_]
Image plugin for Mac OS icons.
For more information about this class, see `*The IcnsImageFile
Class* <#PIL.IcnsImagePlugin.IcnsImageFile-class>`_.
The IcnsImageFile Class
-----------------------
**IcnsImageFile** (class)
[`# <#PIL.IcnsImagePlugin.IcnsImageFile-class>`_]

View File

@ -1,17 +0,0 @@
=============================
The PIL.IcoImagePlugin Module
=============================
The PIL.IcoImagePlugin Module
=============================
**IcoImageFile** (class) [`# <#PIL.IcoImagePlugin.IcoImageFile-class>`_]
Image plugin for Windows Icon files.
For more information about this class, see `*The IcoImageFile
Class* <#PIL.IcoImagePlugin.IcoImageFile-class>`_.
The IcoImageFile Class
----------------------
**IcoImageFile** (class) [`# <#PIL.IcoImagePlugin.IcoImageFile-class>`_]

View File

@ -1,17 +0,0 @@
============================
The PIL.ImImagePlugin Module
============================
The PIL.ImImagePlugin Module
============================
**ImImageFile** (class) [`# <#PIL.ImImagePlugin.ImImageFile-class>`_]
Image plugin for the IFUNC IM file format.
For more information about this class, see `*The ImImageFile
Class* <#PIL.ImImagePlugin.ImImageFile-class>`_.
The ImImageFile Class
---------------------
**ImImageFile** (class) [`# <#PIL.ImImagePlugin.ImImageFile-class>`_]

View File

@ -1,557 +0,0 @@
====================
The PIL.Image Module
====================
The PIL.Image Module
====================
**blend(im1, im2, alpha)** [`# <#PIL.Image.blend-function>`_]
Creates a new image by interpolating between two input images, using
a constant alpha.
::
out = image1 * (1.0 - alpha) + image2 * alpha
*im1*
*im2*
*alpha*
Returns:
**composite(image1, image2, mask)**
[`# <#PIL.Image.composite-function>`_]
*image1*
*image2*
*mask*
**eval(image, function)** [`# <#PIL.Image.eval-function>`_]
*image*
*function*
Returns:
**frombuffer(mode, size, data, decoder\_name="raw", \*args)**
[`# <#PIL.Image.frombuffer-function>`_]
(New in 1.1.4) Creates an image memory referencing pixel data in a
byte buffer.
This function is similar to
`**frombytes** <#PIL.Image.frombytes-function>`_, but uses data in
the byte buffer, where possible. This means that changes to the
original buffer object are reflected in this image). Not all modes
can share memory; support modes include "L", "RGBX", "RGBA", and
"CMYK". For other modes, this function behaves like a corresponding
call to the **fromstring** function.
Note that this function decodes pixel data only, not entire images.
If you have an entire image file in a string, wrap it in a
**StringIO** object, and use `**open** <#PIL.Image.open-function>`_
to load it.
*mode*
*size*
*data*
*decoder\_name*
*\*args*
Returns:
**frombytes(mode, size, data, decoder\_name="raw", \*args)**
[`# <#PIL.Image.frombytes-function>`_]
Creates a copy of an image memory from pixel data in a buffer.
In its simplest form, this function takes three arguments (mode,
size, and unpacked pixel data).
You can also use any pixel decoder supported by PIL. For more
information on available decoders, see the section `*Writing Your
Own File Decoder* <pil-decoder.htm>`_.
Note that this function decodes pixel data only, not entire images.
If you have an entire image in a string, wrap it in a **StringIO**
object, and use `**open** <#PIL.Image.open-function>`_ to load it.
*mode*
*size*
*data*
*decoder\_name*
*\*args*
Returns:
**getmodebandnames(mode)** [`# <#PIL.Image.getmodebandnames-function>`_]
Gets a list of individual band names. Given a mode, this function
returns a tuple containing the names of individual bands (use
`**getmodetype** <#PIL.Image.getmodetype-function>`_ to get the mode
used to store each individual band.
*mode*
Returns:
Raises **KeyError**:
**getmodebands(mode)** [`# <#PIL.Image.getmodebands-function>`_]
*mode*
Returns:
Raises **KeyError**:
**getmodebase(mode)** [`# <#PIL.Image.getmodebase-function>`_]
*mode*
Returns:
Raises **KeyError**:
**getmodetype(mode)** [`# <#PIL.Image.getmodetype-function>`_]
*mode*
Returns:
Raises **KeyError**:
**Image()** (class) [`# <#PIL.Image.Image-class>`_]
This class represents an image object.
For more information about this class, see `*The Image
Class* <#PIL.Image.Image-class>`_.
**init()** [`# <#PIL.Image.init-function>`_]
**isDirectory(f)** [`# <#PIL.Image.isDirectory-function>`_]
**isImageType(t)** [`# <#PIL.Image.isImageType-function>`_]
**isStringType(t)** [`# <#PIL.Image.isStringType-function>`_]
**merge(mode, bands)** [`# <#PIL.Image.merge-function>`_]
*mode*
*bands*
Returns:
**new(mode, size, color=0)** [`# <#PIL.Image.new-function>`_]
*mode*
*size*
*color*
Returns:
**open(file, mode="r")** [`# <#PIL.Image.open-function>`_]
Opens and identifies the given image file.
This is a lazy operation; this function identifies the file, but the
actual image data is not read from the file until you try to process
the data (or call the `**load** <#PIL.Image.Image.load-method>`_
method).
*file*
A filename (string) or a file object. The file object must
implement **read**, **seek**, and **tell** methods, and be
opened in binary mode.
*mode*
Returns:
Raises **IOError**:
**preinit()** [`# <#PIL.Image.preinit-function>`_]
**register\_extension(id, extension)**
[`# <#PIL.Image.register_extension-function>`_]
*id*
*extension*
**register\_mime(id, mimetype)**
[`# <#PIL.Image.register_mime-function>`_]
*id*
*mimetype*
**register\_open(id, factory, accept=None)**
[`# <#PIL.Image.register_open-function>`_]
*id*
*factory*
*accept*
**register\_save(id, driver)**
[`# <#PIL.Image.register_save-function>`_]
*id*
*driver*
The Image Class
---------------
**Image()** (class) [`# <#PIL.Image.Image-class>`_]
**convert(mode, matrix=None)** [`# <#PIL.Image.Image.convert-method>`_]
Returns a converted copy of this image. For the "P" mode, this
method translates pixels through the palette. If mode is omitted, a
mode is chosen so that all information in the image and the palette
can be represented without a palette.
The current version supports all possible conversions between "L",
"RGB" and "CMYK."
When translating a colour image to black and white (mode "L"), the
library uses the ITU-R 601-2 luma transform:
**L = R \* 299/1000 + G \* 587/1000 + B \* 114/1000**
When translating a greyscale image into a bilevel image (mode "1"),
all non-zero values are set to 255 (white). To use other thresholds,
use the `**point** <#PIL.Image.Image.point-method>`_ method.
*mode*
*matrix*
Returns:
**copy()** [`# <#PIL.Image.Image.copy-method>`_]
Returns:
**crop(box=None)** [`# <#PIL.Image.Image.crop-method>`_]
Returns a rectangular region from this image. The box is a 4-tuple
defining the left, upper, right, and lower pixel coordinate.
This is a lazy operation. Changes to the source image may or may not
be reflected in the cropped image. To break the connection, call the
`**load** <#PIL.Image.Image.load-method>`_ method on the cropped
copy.
*The*
Returns:
**draft(mode, size)** [`# <#PIL.Image.Image.draft-method>`_]
Configures the image file loader so it returns a version of the
image that as closely as possible matches the given mode and size.
For example, you can use this method to convert a colour JPEG to
greyscale while loading it, or to extract a 128x192 version from a
PCD file.
Note that this method modifies the Image object in place. If the
image has already been loaded, this method has no effect.
*mode*
*size*
**filter(filter)** [`# <#PIL.Image.Image.filter-method>`_]
Filters this image using the given filter. For a list of available
filters, see the **ImageFilter** module.
*filter*
Returns:
**frombytes(data, decoder\_name="raw", \*args)**
[`# <#PIL.Image.Image.frombytes-method>`_]
Loads this image with pixel data from a byte uffer.
This method is similar to the
`**frombytes** <#PIL.Image.frombytes-function>`_ function, but
loads data into this image instead of creating a new image object.
(In Python 2.6 and 2.7, this is also available as fromstring().)
**getbands()** [`# <#PIL.Image.Image.getbands-method>`_]
Returns a tuple containing the name of each band in this image. For
example, **getbands** on an RGB image returns ("R", "G", "B").
Returns:
**getbbox()** [`# <#PIL.Image.Image.getbbox-method>`_]
Returns:
**getcolors(maxcolors=256)** [`# <#PIL.Image.Image.getcolors-method>`_]
*maxcolors*
Returns:
**getdata(band=None)** [`# <#PIL.Image.Image.getdata-method>`_]
Returns the contents of this image as a sequence object containing
pixel values. The sequence object is flattened, so that values for
line one follow directly after the values of line zero, and so on.
Note that the sequence object returned by this method is an internal
PIL data type, which only supports certain sequence operations. To
convert it to an ordinary sequence (e.g. for printing), use
**list(im.getdata())**.
*band*
Returns:
**getextrema()** [`# <#PIL.Image.Image.getextrema-method>`_]
Returns:
**getim()** [`# <#PIL.Image.Image.getim-method>`_]
Returns:
**getpalette()** [`# <#PIL.Image.Image.getpalette-method>`_]
Returns:
**getpixel(xy)** [`# <#PIL.Image.Image.getpixel-method>`_]
*xy*
Returns:
**getprojection()** [`# <#PIL.Image.Image.getprojection-method>`_]
Returns:
**histogram(mask=None)** [`# <#PIL.Image.Image.histogram-method>`_]
Returns a histogram for the image. The histogram is returned as a
list of pixel counts, one for each pixel value in the source image.
If the image has more than one band, the histograms for all bands
are concatenated (for example, the histogram for an "RGB" image
contains 768 values).
A bilevel image (mode "1") is treated as a greyscale ("L") image by
this method.
If a mask is provided, the method returns a histogram for those
parts of the image where the mask image is non-zero. The mask image
must have the same size as the image, and be either a bi-level image
(mode "1") or a greyscale image ("L").
*mask*
Returns:
**load()** [`# <#PIL.Image.Image.load-method>`_]
Returns:
**offset(xoffset, yoffset=None)**
[`# <#PIL.Image.Image.offset-method>`_]
(Deprecated) Returns a copy of the image where the data has been
offset by the given distances. Data wraps around the edges. If
yoffset is omitted, it is assumed to be equal to xoffset.
This method is deprecated. New code should use the **offset**
function in the **ImageChops** module.
*xoffset*
*yoffset*
Returns:
**paste(im, box=None, mask=None)**
[`# <#PIL.Image.Image.paste-method>`_]
Pastes another image into this image. The box argument is either a
2-tuple giving the upper left corner, a 4-tuple defining the left,
upper, right, and lower pixel coordinate, or None (same as (0, 0)).
If a 4-tuple is given, the size of the pasted image must match the
size of the region.
If the modes don't match, the pasted image is converted to the mode
of this image (see the
`**convert** <#PIL.Image.Image.convert-method>`_ method for
details).
Instead of an image, the source can be a integer or tuple containing
pixel values. The method then fills the region with the given
colour. When creating RGB images, you can also use colour strings as
supported by the ImageColor module.
If a mask is given, this method updates only the regions indicated
by the mask. You can use either "1", "L" or "RGBA" images (in the
latter case, the alpha band is used as mask). Where the mask is 255,
the given image is copied as is. Where the mask is 0, the current
value is preserved. Intermediate values can be used for transparency
effects.
Note that if you paste an "RGBA" image, the alpha band is ignored.
You can work around this by using the same image as both source
image and mask.
*im*
*box*
An optional 4-tuple giving the region to paste into. If a
2-tuple is used instead, it's treated as the upper left corner.
If omitted or None, the source is pasted into the upper left
corner.
If an image is given as the second argument and there is no
third, the box defaults to (0, 0), and the second argument is
interpreted as a mask image.
*mask*
Returns:
**point(lut, mode=None)** [`# <#PIL.Image.Image.point-method>`_]
*lut*
*mode*
Returns:
**putalpha(alpha)** [`# <#PIL.Image.Image.putalpha-method>`_]
*im*
**putdata(data, scale=1.0, offset=0.0)**
[`# <#PIL.Image.Image.putdata-method>`_]
Copies pixel data to this image. This method copies data from a
sequence object into the image, starting at the upper left corner
(0, 0), and continuing until either the image or the sequence ends.
The scale and offset values are used to adjust the sequence values:
**pixel = value\*scale + offset**.
*data*
*scale*
*offset*
**putpalette(data)** [`# <#PIL.Image.Image.putpalette-method>`_]
*data*
**putpixel(xy, value)** [`# <#PIL.Image.Image.putpixel-method>`_]
Modifies the pixel at the given position. The colour is given as a
single numerical value for single-band images, and a tuple for
multi-band images.
Note that this method is relatively slow. For more extensive
changes, use `**paste** <#PIL.Image.Image.paste-method>`_ or the
**ImageDraw** module instead.
*xy*
*value*
**resize(size, filter=NEAREST)** [`# <#PIL.Image.Image.resize-method>`_]
*size*
*filter*
An optional resampling filter. This can be one of **NEAREST**
(use nearest neighbour), **BILINEAR** (linear interpolation in a
2x2 environment), **BICUBIC** (cubic spline interpolation in a
4x4 environment), or **ANTIALIAS** (a high-quality downsampling
filter). If omitted, or if the image has mode "1" or "P", it is
set **NEAREST**.
Returns:
**rotate(angle, filter=NEAREST)**
[`# <#PIL.Image.Image.rotate-method>`_]
*angle*
*filter*
An optional resampling filter. This can be one of **NEAREST**
(use nearest neighbour), **BILINEAR** (linear interpolation in a
2x2 environment), or **BICUBIC** (cubic spline interpolation in
a 4x4 environment). If omitted, or if the image has mode "1" or
"P", it is set **NEAREST**.
Returns:
**save(file, format=None, \*\*options)**
[`# <#PIL.Image.Image.save-method>`_]
Saves this image under the given filename. If no format is
specified, the format to use is determined from the filename
extension, if possible.
Keyword options can be used to provide additional instructions to
the writer. If a writer doesn't recognise an option, it is silently
ignored. The available options are described later in this handbook.
You can use a file object instead of a filename. In this case, you
must always specify the format. The file object must implement the
**seek**, **tell**, and **write** methods, and be opened in binary
mode.
*file*
*format*
*\*\*options*
Returns:
Raises **KeyError**:
Raises **IOError**:
**seek(frame)** [`# <#PIL.Image.Image.seek-method>`_]
Seeks to the given frame in this sequence file. If you seek beyond
the end of the sequence, the method raises an **EOFError**
exception. When a sequence file is opened, the library automatically
seeks to frame 0.
Note that in the current version of the library, most sequence
formats only allows you to seek to the next frame.
*frame*
Raises **EOFError**:
**show(title=None)** [`# <#PIL.Image.Image.show-method>`_]
Displays this image. This method is mainly intended for debugging
purposes.
On Unix platforms, this method saves the image to a temporary PPM
file, and calls the **xv** utility.
On Windows, it saves the image to a temporary BMP file, and uses the
standard BMP display utility to show it (usually Paint).
*title*
**split()** [`# <#PIL.Image.Image.split-method>`_]
Returns:
**tell()** [`# <#PIL.Image.Image.tell-method>`_]
Returns:
**thumbnail(size, resample=NEAREST)**
[`# <#PIL.Image.Image.thumbnail-method>`_]
Make this image into a thumbnail. This method modifies the image to
contain a thumbnail version of itself, no larger than the given
size. This method calculates an appropriate thumbnail size to
preserve the aspect of the image, calls the
`**draft** <#PIL.Image.Image.draft-method>`_ method to configure the
file reader (where applicable), and finally resizes the image.
Note that the bilinear and bicubic filters in the current version of
PIL are not well-suited for thumbnail generation. You should use
**ANTIALIAS** unless speed is much more important than quality.
Also note that this function modifies the Image object in place. If
you need to use the full resolution image as well, apply this method
to a `**copy** <#PIL.Image.Image.copy-method>`_ of the original
image.
*size*
*resample*
Optional resampling filter. This can be one of **NEAREST**,
**BILINEAR**, **BICUBIC**, or **ANTIALIAS** (best quality). If
omitted, it defaults to **NEAREST** (this will be changed to
ANTIALIAS in a future version).
Returns:
**tobitmap(name="image")** [`# <#PIL.Image.Image.tobitmap-method>`_]
*name*
Returns:
Raises **ValueError**:
**tobytes(encoder\_name="raw", \*args)**
[`# <#PIL.Image.Image.tobytes-method>`_]
(In Python 2.6 and 2.7, this is also available as tostring().)
*encoder\_name*
*\*args*
Returns:
**transform(size, method, data, resample=NEAREST)**
[`# <#PIL.Image.Image.transform-method>`_]
Transforms this image. This method creates a new image with the
given size, and the same mode as the original, and copies data to
the new image using the given transform.
*size*
*method*
The transformation method. This is one of **EXTENT** (cut out a
rectangular subregion), **AFFINE** (affine transform),
**PERSPECTIVE** (perspective transform), **QUAD** (map a
quadrilateral to a rectangle), or **MESH** (map a number of
source quadrilaterals in one operation).
*data*
*resample*
Optional resampling filter. It can be one of **NEAREST** (use
nearest neighbour), **BILINEAR** (linear interpolation in a 2x2
environment), or **BICUBIC** (cubic spline interpolation in a
4x4 environment). If omitted, or if the image has mode "1" or
"P", it is set to **NEAREST**.
Returns:
**transpose(method)** [`# <#PIL.Image.Image.transpose-method>`_]
*method*
One of **FLIP\_LEFT\_RIGHT**, **FLIP\_TOP\_BOTTOM**,
**ROTATE\_90**, **ROTATE\_180**, or **ROTATE\_270**.
**verify()** [`# <#PIL.Image.Image.verify-method>`_]

View File

@ -1,163 +0,0 @@
=========================
The PIL.ImageChops Module
=========================
The PIL.ImageChops Module
=========================
The **ImageChops** module contains a number of arithmetical image
operations, called *channel operations* ("chops"). These can be used for
various purposes, including special effects, image compositions,
algorithmic painting, and more.
At this time, channel operations are only implemented for 8-bit images
(e.g. "L" and "RGB").
Most channel operations take one or two image arguments and returns a
new image. Unless otherwise noted, the result of a channel operation is
always clipped to the range 0 to MAX (which is 255 for all modes
supported by the operations in this module).
Module Contents
---------------
**add(image1, image2, scale=1.0, offset=0)**
[`# <#PIL.ImageChops.add-function>`_]
Add images ((image1 + image2) / scale + offset).
Adds two images, dividing the result by scale and adding the offset.
If omitted, scale defaults to 1.0, and offset to 0.0.
*image1*
*image1*
Returns:
**add\_modulo(image1, image2)**
[`# <#PIL.ImageChops.add_modulo-function>`_]
Add images without clipping ((image1 + image2) % MAX).
Adds two images, without clipping the result.
*image1*
*image1*
Returns:
**blend(image1, image2, alpha)** [`# <#PIL.ImageChops.blend-function>`_]
Blend images using constant transparency weight.
Same as the **blend** function in the **Image** module.
**composite(image1, image2, mask)**
[`# <#PIL.ImageChops.composite-function>`_]
Create composite using transparency mask.
Same as the **composite** function in the **Image** module.
**constant(image, value)** [`# <#PIL.ImageChops.constant-function>`_]
*image*
*value*
Returns:
**darker(image1, image2)** [`# <#PIL.ImageChops.darker-function>`_]
Compare images, and return darker pixel value (min(image1, image2)).
Compares the two images, pixel by pixel, and returns a new image
containing the darker values.
*image1*
*image1*
Returns:
**difference(image1, image2)**
[`# <#PIL.ImageChops.difference-function>`_]
Calculate absolute difference (abs(image1 - image2)).
Returns the absolute value of the difference between the two images.
*image1*
*image1*
Returns:
**duplicate(image)** [`# <#PIL.ImageChops.duplicate-function>`_]
*image*
Returns:
**invert(image)** [`# <#PIL.ImageChops.invert-function>`_]
*image*
Returns:
**lighter(image1, image2)** [`# <#PIL.ImageChops.lighter-function>`_]
Compare images, and return lighter pixel value (max(image1,
image2)).
Compares the two images, pixel by pixel, and returns a new image
containing the lighter values.
*image1*
*image1*
Returns:
**logical\_and(image1, image2)**
[`# <#PIL.ImageChops.logical_and-function>`_]
**logical\_or(image1, image2)**
[`# <#PIL.ImageChops.logical_or-function>`_]
**logical\_xor(image1, image2)**
[`# <#PIL.ImageChops.logical_xor-function>`_]
**multiply(image1, image2)** [`# <#PIL.ImageChops.multiply-function>`_]
Superimpose positive images (image1 \* image2 / MAX).
Superimposes two images on top of each other. If you multiply an
image with a solid black image, the result is black. If you multiply
with a solid white image, the image is unaffected.
*image1*
*image1*
Returns:
**offset(image, xoffset, yoffset=None)**
[`# <#PIL.ImageChops.offset-function>`_]
Offset image data.
Returns a copy of the image where data has been offset by the given
distances. Data wraps around the edges. If yoffset is omitted, it is
assumed to be equal to xoffset.
*image*
*xoffset*
*yoffset*
Returns:
**screen(image1, image2)** [`# <#PIL.ImageChops.screen-function>`_]
Superimpose negative images (MAX - ((MAX - image1) \* (MAX - image2)
/ MAX)).
Superimposes two inverted images on top of each other.
*image1*
*image1*
Returns:
**subtract(image1, image2, scale=1.0, offset=0)**
[`# <#PIL.ImageChops.subtract-function>`_]
Subtract images ((image1 - image2) / scale + offset).
Subtracts two images, dividing the result by scale and adding the
offset. If omitted, scale defaults to 1.0, and offset to 0.0.
*image1*
*image1*
Returns:
**subtract\_modulo(image1, image2)**
[`# <#PIL.ImageChops.subtract_modulo-function>`_]
Subtract images without clipping ((image1 - image2) % MAX).
Subtracts two images, without clipping the result.
*image1*
*image1*
Returns:

View File

@ -1,13 +0,0 @@
=========================
The PIL.ImageColor Module
=========================
The PIL.ImageColor Module
=========================
**getrgb(color)** [`# <#PIL.ImageColor.getrgb-function>`_]
*color*
Returns:
Raises **ValueError**:

View File

@ -1,69 +0,0 @@
========================
The PIL.ImageDraw Module
========================
The PIL.ImageDraw Module
========================
**Draw(im, mode=None)** [`# <#PIL.ImageDraw.Draw-function>`_]
*im*
*mode*
**getdraw(im=None, hints=None)**
[`# <#PIL.ImageDraw.getdraw-function>`_]
*im*
*hints*
Returns:
**ImageDraw(im, mode=None)** (class)
[`# <#PIL.ImageDraw.ImageDraw-class>`_]
A simple 2D drawing interface for PIL images.
For more information about this class, see `*The ImageDraw
Class* <#PIL.ImageDraw.ImageDraw-class>`_.
The ImageDraw Class
-------------------
**ImageDraw(im, mode=None)** (class)
[`# <#PIL.ImageDraw.ImageDraw-class>`_]
A simple 2D drawing interface for PIL images.
Application code should use the **Draw** factory, instead of
directly.
**\_\_init\_\_(im, mode=None)**
[`# <#PIL.ImageDraw.ImageDraw.__init__-method>`_]
*im*
*mode*
**arc(xy, start, end, fill=None)**
[`# <#PIL.ImageDraw.ImageDraw.arc-method>`_]
**bitmap(xy, bitmap, fill=None)**
[`# <#PIL.ImageDraw.ImageDraw.bitmap-method>`_]
**chord(xy, start, end, fill=None, outline=None)**
[`# <#PIL.ImageDraw.ImageDraw.chord-method>`_]
**ellipse(xy, fill=None, outline=None)**
[`# <#PIL.ImageDraw.ImageDraw.ellipse-method>`_]
**getfont()** [`# <#PIL.ImageDraw.ImageDraw.getfont-method>`_]
**line(xy, fill=None, width=0)**
[`# <#PIL.ImageDraw.ImageDraw.line-method>`_]
**pieslice(xy, start, end, fill=None, outline=None)**
[`# <#PIL.ImageDraw.ImageDraw.pieslice-method>`_]
**point(xy, fill=None)** [`# <#PIL.ImageDraw.ImageDraw.point-method>`_]
**polygon(xy, fill=None, outline=None)**
[`# <#PIL.ImageDraw.ImageDraw.polygon-method>`_]
**rectangle(xy, fill=None, outline=None)**
[`# <#PIL.ImageDraw.ImageDraw.rectangle-method>`_]
**setfill(onoff)** [`# <#PIL.ImageDraw.ImageDraw.setfill-method>`_]
**setfont(font)** [`# <#PIL.ImageDraw.ImageDraw.setfont-method>`_]
**setink(ink)** [`# <#PIL.ImageDraw.ImageDraw.setink-method>`_]
**shape(shape, fill=None, outline=None)**
[`# <#PIL.ImageDraw.ImageDraw.shape-method>`_]
**text(xy, text, fill=None, font=None, anchor=None)**
[`# <#PIL.ImageDraw.ImageDraw.text-method>`_]
**textsize(text, font=None)**
[`# <#PIL.ImageDraw.ImageDraw.textsize-method>`_]

View File

@ -1,74 +0,0 @@
===========================
The PIL.ImageEnhance Module
===========================
The PIL.ImageEnhance Module
===========================
**Brightness(image)** (class)
[`# <#PIL.ImageEnhance.Brightness-class>`_]
Brightness enhancement object.
For more information about this class, see `*The Brightness
Class* <#PIL.ImageEnhance.Brightness-class>`_.
**Color(image)** (class) [`# <#PIL.ImageEnhance.Color-class>`_]
Color enhancement object.
For more information about this class, see `*The Color
Class* <#PIL.ImageEnhance.Color-class>`_.
**Contrast(image)** (class) [`# <#PIL.ImageEnhance.Contrast-class>`_]
Contrast enhancement object.
For more information about this class, see `*The Contrast
Class* <#PIL.ImageEnhance.Contrast-class>`_.
**Sharpness(image)** (class) [`# <#PIL.ImageEnhance.Sharpness-class>`_]
Sharpness enhancement object.
For more information about this class, see `*The Sharpness
Class* <#PIL.ImageEnhance.Sharpness-class>`_.
The Brightness Class
--------------------
**Brightness(image)** (class)
[`# <#PIL.ImageEnhance.Brightness-class>`_]
Brightness enhancement object.
This class can be used to control the brighntess of an image. An
enhancement factor of 0.0 gives a black image, factor 1.0 gives the
original image.
The Color Class
---------------
**Color(image)** (class) [`# <#PIL.ImageEnhance.Color-class>`_]
Color enhancement object.
This class can be used to adjust the colour balance of an image, in
a manner similar to the controls on a colour TV set. An enhancement
factor of 0.0 gives a black and white image, a factor of 1.0 gives
the original image.
The Contrast Class
------------------
**Contrast(image)** (class) [`# <#PIL.ImageEnhance.Contrast-class>`_]
Contrast enhancement object.
This class can be used to control the contrast of an image, similar
to the contrast control on a TV set. An enhancement factor of 0.0
gives an solid grey image, factor 1.0 gives the original image.
The Sharpness Class
-------------------
**Sharpness(image)** (class) [`# <#PIL.ImageEnhance.Sharpness-class>`_]
Sharpness enhancement object.
This class can be used to adjust the sharpness of an image. The
enhancement factor 0.0 gives a blurred image, 1.0 gives the original
image, and a factor of 2.0 gives a sharpened image.

View File

@ -1,84 +0,0 @@
========================
The PIL.ImageFile Module
========================
The PIL.ImageFile Module
========================
**\_ParserFile(data)** (class) [`# <#PIL.ImageFile._ParserFile-class>`_]
(Internal) Support class for the Parser file.
For more information about this class, see `*The \_ParserFile
Class* <#PIL.ImageFile._ParserFile-class>`_.
**\_safe\_read(fp, size)** [`# <#PIL.ImageFile._safe_read-function>`_]
*fp*
File handle. Must implement a **read** method.
*size*
Returns:
A string containing up to *size* bytes of data.
**\_save(im, fp, tile)** [`# <#PIL.ImageFile._save-function>`_]
*im*
*fp*
*tile*
**ImageFile(fp=None, filename=None)** (class)
[`# <#PIL.ImageFile.ImageFile-class>`_]
Base class for image file handlers.
For more information about this class, see `*The ImageFile
Class* <#PIL.ImageFile.ImageFile-class>`_.
**Parser** (class) [`# <#PIL.ImageFile.Parser-class>`_]
Incremental image parser.
For more information about this class, see `*The Parser
Class* <#PIL.ImageFile.Parser-class>`_.
**StubImageFile** (class) [`# <#PIL.ImageFile.StubImageFile-class>`_]
Base class for stub image loaders.
For more information about this class, see `*The StubImageFile
Class* <#PIL.ImageFile.StubImageFile-class>`_.
The \_ParserFile Class
----------------------
**\_ParserFile(data)** (class) [`# <#PIL.ImageFile._ParserFile-class>`_]
(Internal) Support class for the **Parser** file.
The ImageFile Class
-------------------
**ImageFile(fp=None, filename=None)** (class)
[`# <#PIL.ImageFile.ImageFile-class>`_]
The Parser Class
----------------
**Parser** (class) [`# <#PIL.ImageFile.Parser-class>`_]
**close()** [`# <#PIL.ImageFile.Parser.close-method>`_]
Returns:
Raises **IOError**:
**feed(data)** [`# <#PIL.ImageFile.Parser.feed-method>`_]
*data*
Raises **IOError**:
**reset()** [`# <#PIL.ImageFile.Parser.reset-method>`_]
The StubImageFile Class
-----------------------
**StubImageFile** (class) [`# <#PIL.ImageFile.StubImageFile-class>`_]
Base class for stub image loaders.
A stub loader is an image loader that can identify files of a
certain format, but relies on external code to load the file.
**\_load()** [`# <#PIL.ImageFile.StubImageFile._load-method>`_]

View File

@ -1,32 +0,0 @@
==========================
The PIL.ImageFileIO Module
==========================
The PIL.ImageFileIO Module
==========================
**ImageFileIO(fp)** (class) [`# <#PIL.ImageFileIO.ImageFileIO-class>`_]
The ImageFileIO module can be used to read an image from a socket,
or any other stream device.
For more information about this class, see `*The ImageFileIO
Class* <#PIL.ImageFileIO.ImageFileIO-class>`_.
The ImageFileIO Class
---------------------
**ImageFileIO(fp)** (class) [`# <#PIL.ImageFileIO.ImageFileIO-class>`_]
The **ImageFileIO** module can be used to read an image from a
socket, or any other stream device.
This module is deprecated. New code should use the **Parser** class
in the `ImageFile <imagefile>`_ module instead.
**\_\_init\_\_(fp)**
[`# <#PIL.ImageFileIO.ImageFileIO.__init__-method>`_]
Adds buffering to a stream file object, in order to provide **seek**
and **tell** methods required by the **Image.open** method. The
stream object must implement **read** and **close** methods.
*fp*

View File

@ -1,226 +0,0 @@
==========================
The PIL.ImageFilter Module
==========================
The PIL.ImageFilter Module
==========================
**BLUR** (class) [`# <#PIL.ImageFilter.BLUR-class>`_]
Blur filter.
For more information about this class, see `*The BLUR
Class* <#PIL.ImageFilter.BLUR-class>`_.
**CONTOUR** (class) [`# <#PIL.ImageFilter.CONTOUR-class>`_]
Contour filter.
For more information about this class, see `*The CONTOUR
Class* <#PIL.ImageFilter.CONTOUR-class>`_.
**DETAIL** (class) [`# <#PIL.ImageFilter.DETAIL-class>`_]
Detail filter.
For more information about this class, see `*The DETAIL
Class* <#PIL.ImageFilter.DETAIL-class>`_.
**EDGE\_ENHANCE** (class) [`# <#PIL.ImageFilter.EDGE_ENHANCE-class>`_]
Edge enhancement filter.
For more information about this class, see `*The EDGE\_ENHANCE
Class* <#PIL.ImageFilter.EDGE_ENHANCE-class>`_.
**EDGE\_ENHANCE\_MORE** (class)
[`# <#PIL.ImageFilter.EDGE_ENHANCE_MORE-class>`_]
Stronger edge enhancement filter.
For more information about this class, see `*The EDGE\_ENHANCE\_MORE
Class* <#PIL.ImageFilter.EDGE_ENHANCE_MORE-class>`_.
**EMBOSS** (class) [`# <#PIL.ImageFilter.EMBOSS-class>`_]
Embossing filter.
For more information about this class, see `*The EMBOSS
Class* <#PIL.ImageFilter.EMBOSS-class>`_.
**FIND\_EDGES** (class) [`# <#PIL.ImageFilter.FIND_EDGES-class>`_]
Edge-finding filter.
For more information about this class, see `*The FIND\_EDGES
Class* <#PIL.ImageFilter.FIND_EDGES-class>`_.
**Kernel(size, kernel, \*\*options)** (class)
[`# <#PIL.ImageFilter.Kernel-class>`_]
Convolution filter kernel.
For more information about this class, see `*The Kernel
Class* <#PIL.ImageFilter.Kernel-class>`_.
**MaxFilter(size=3)** (class) [`# <#PIL.ImageFilter.MaxFilter-class>`_]
Max filter.
For more information about this class, see `*The MaxFilter
Class* <#PIL.ImageFilter.MaxFilter-class>`_.
**MedianFilter(size=3)** (class)
[`# <#PIL.ImageFilter.MedianFilter-class>`_]
Median filter.
For more information about this class, see `*The MedianFilter
Class* <#PIL.ImageFilter.MedianFilter-class>`_.
**MinFilter(size=3)** (class) [`# <#PIL.ImageFilter.MinFilter-class>`_]
Min filter.
For more information about this class, see `*The MinFilter
Class* <#PIL.ImageFilter.MinFilter-class>`_.
**ModeFilter(size=3)** (class)
[`# <#PIL.ImageFilter.ModeFilter-class>`_]
Mode filter.
For more information about this class, see `*The ModeFilter
Class* <#PIL.ImageFilter.ModeFilter-class>`_.
**RankFilter(size, rank)** (class)
[`# <#PIL.ImageFilter.RankFilter-class>`_]
Rank filter.
For more information about this class, see `*The RankFilter
Class* <#PIL.ImageFilter.RankFilter-class>`_.
**SHARPEN** (class) [`# <#PIL.ImageFilter.SHARPEN-class>`_]
Sharpening filter.
For more information about this class, see `*The SHARPEN
Class* <#PIL.ImageFilter.SHARPEN-class>`_.
**SMOOTH** (class) [`# <#PIL.ImageFilter.SMOOTH-class>`_]
Smoothing filter.
For more information about this class, see `*The SMOOTH
Class* <#PIL.ImageFilter.SMOOTH-class>`_.
**SMOOTH\_MORE** (class) [`# <#PIL.ImageFilter.SMOOTH_MORE-class>`_]
Stronger smoothing filter.
For more information about this class, see `*The SMOOTH\_MORE
Class* <#PIL.ImageFilter.SMOOTH_MORE-class>`_.
The BLUR Class
--------------
**BLUR** (class) [`# <#PIL.ImageFilter.BLUR-class>`_]
The CONTOUR Class
-----------------
**CONTOUR** (class) [`# <#PIL.ImageFilter.CONTOUR-class>`_]
The DETAIL Class
----------------
**DETAIL** (class) [`# <#PIL.ImageFilter.DETAIL-class>`_]
The EDGE\_ENHANCE Class
-----------------------
**EDGE\_ENHANCE** (class) [`# <#PIL.ImageFilter.EDGE_ENHANCE-class>`_]
The EDGE\_ENHANCE\_MORE Class
-----------------------------
**EDGE\_ENHANCE\_MORE** (class)
[`# <#PIL.ImageFilter.EDGE_ENHANCE_MORE-class>`_]
The EMBOSS Class
----------------
**EMBOSS** (class) [`# <#PIL.ImageFilter.EMBOSS-class>`_]
The FIND\_EDGES Class
---------------------
**FIND\_EDGES** (class) [`# <#PIL.ImageFilter.FIND_EDGES-class>`_]
The Kernel Class
----------------
**Kernel(size, kernel, \*\*options)** (class)
[`# <#PIL.ImageFilter.Kernel-class>`_]
**\_\_init\_\_(size, kernel, \*\*options)**
[`# <#PIL.ImageFilter.Kernel.__init__-method>`_]
Create a convolution kernel. The current version only supports 3x3
and 5x5 integer and floating point kernels.
In the current version, kernels can only be applied to "L" and "RGB"
images.
*size*
*kernel*
*\*\*options*
*scale=*
*offset=*
The MaxFilter Class
-------------------
**MaxFilter(size=3)** (class) [`# <#PIL.ImageFilter.MaxFilter-class>`_]
**\_\_init\_\_(size=3)**
[`# <#PIL.ImageFilter.MaxFilter.__init__-method>`_]
*size*
The MedianFilter Class
----------------------
**MedianFilter(size=3)** (class)
[`# <#PIL.ImageFilter.MedianFilter-class>`_]
**\_\_init\_\_(size=3)**
[`# <#PIL.ImageFilter.MedianFilter.__init__-method>`_]
*size*
The MinFilter Class
-------------------
**MinFilter(size=3)** (class) [`# <#PIL.ImageFilter.MinFilter-class>`_]
**\_\_init\_\_(size=3)**
[`# <#PIL.ImageFilter.MinFilter.__init__-method>`_]
*size*
The ModeFilter Class
--------------------
**ModeFilter(size=3)** (class)
[`# <#PIL.ImageFilter.ModeFilter-class>`_]
**\_\_init\_\_(size=3)**
[`# <#PIL.ImageFilter.ModeFilter.__init__-method>`_]
*size*
The RankFilter Class
--------------------
**RankFilter(size, rank)** (class)
[`# <#PIL.ImageFilter.RankFilter-class>`_]
**\_\_init\_\_(size, rank)**
[`# <#PIL.ImageFilter.RankFilter.__init__-method>`_]
*size*
*rank*
The SHARPEN Class
-----------------
**SHARPEN** (class) [`# <#PIL.ImageFilter.SHARPEN-class>`_]
The SMOOTH Class
----------------
**SMOOTH** (class) [`# <#PIL.ImageFilter.SMOOTH-class>`_]
The SMOOTH\_MORE Class
----------------------
**SMOOTH\_MORE** (class) [`# <#PIL.ImageFilter.SMOOTH_MORE-class>`_]

View File

@ -1,98 +0,0 @@
========================
The PIL.ImageFont Module
========================
The PIL.ImageFont Module
========================
**FreeTypeFont(file, size, index=0, encoding="")** (class)
[`# <#PIL.ImageFont.FreeTypeFont-class>`_]
Wrapper for FreeType fonts.
For more information about this class, see `*The FreeTypeFont
Class* <#PIL.ImageFont.FreeTypeFont-class>`_.
**ImageFont** (class) [`# <#PIL.ImageFont.ImageFont-class>`_]
The ImageFont module defines a class with the same name.
For more information about this class, see `*The ImageFont
Class* <#PIL.ImageFont.ImageFont-class>`_.
**load(filename)** [`# <#PIL.ImageFont.load-function>`_]
*filename*
Returns:
Raises **IOError**:
**load\_default()** [`# <#PIL.ImageFont.load_default-function>`_]
Returns:
**load\_path(filename)** [`# <#PIL.ImageFont.load_path-function>`_]
*filename*
Returns:
Raises **IOError**:
**TransposedFont(font, orientation=None)** (class)
[`# <#PIL.ImageFont.TransposedFont-class>`_]
Wrapper that creates a transposed font from any existing font
object.
*font*
*orientation*
For more information about this class, see `*The TransposedFont
Class* <#PIL.ImageFont.TransposedFont-class>`_.
**truetype(filename, size, index=0, encoding="")**
[`# <#PIL.ImageFont.truetype-function>`_]
Load a TrueType or OpenType font file, and create a font object.
This function loads a font object from the given file, and creates a
font object for a font of the given size.
This function requires the \_imagingft service.
*filename*
A truetype font file. Under Windows, if the file is not found in
this filename, the loader also looks in Windows **fonts**
directory
*size*
*index*
*encoding*
Returns:
Raises **IOError**:
The FreeTypeFont Class
----------------------
**FreeTypeFont(file, size, index=0, encoding="")** (class)
[`# <#PIL.ImageFont.FreeTypeFont-class>`_]
Wrapper for FreeType fonts. Application code should use the
**truetype** factory function to create font objects.
The ImageFont Class
-------------------
**ImageFont** (class) [`# <#PIL.ImageFont.ImageFont-class>`_]
The **ImageFont** module defines a class with the same name.
Instances of this class store bitmap fonts, and are used with the
**text** method of the **ImageDraw** class.
PIL uses it's own font file format to store bitmap fonts. You can
use the **pilfont** utility to convert BDF and PCF font descriptors
(X window font formats) to this format.
Starting with version 1.1.4, PIL can be configured to support
TrueType and OpenType fonts. For earlier version, TrueType support
is only available as part of the imToolkit package
The TransposedFont Class
------------------------
**TransposedFont(font, orientation=None)** (class)
[`# <#PIL.ImageFont.TransposedFont-class>`_]
*font*
*orientation*

View File

@ -1,20 +0,0 @@
======================
The PIL.ImageGL Module
======================
The PIL.ImageGL Module
======================
Module Contents
---------------
**TextureFactory** (class) [`# <#PIL.ImageGL.TextureFactory-class>`_]
Texture factory.
For more information about this class, see `*The TextureFactory
Class* <#PIL.ImageGL.TextureFactory-class>`_.
The TextureFactory Class
------------------------
**TextureFactory** (class) [`# <#PIL.ImageGL.TextureFactory-class>`_]

View File

@ -1,24 +0,0 @@
========================
The PIL.ImageGrab Module
========================
The PIL.ImageGrab Module
========================
(New in 1.1.3) The **ImageGrab** module can be used to copy the contents
of the screen to a PIL image memory.
The current version works on Windows only.
Module Contents
---------------
**grab(bbox=None)** [`# <#PIL.ImageGrab.grab-function>`_]
*bbox*
Returns:
**grabclipboard()** [`# <#PIL.ImageGrab.grabclipboard-function>`_]
Returns:

View File

@ -1,113 +0,0 @@
=======================
The PIL.ImageOps Module
=======================
The PIL.ImageOps Module
=======================
(New in 1.1.3) The **ImageOps** module contains a number of 'ready-made'
image processing operations. This module is somewhat experimental, and
most operators only work on L and RGB images.
Module Contents
---------------
**autocontrast(image, cutoff=0, ignore=None)**
[`# <#PIL.ImageOps.autocontrast-function>`_]
Maximize (normalize) image contrast. This function calculates a
histogram of the input image, removes *cutoff* percent of the
lightest and darkest pixels from the histogram, and remaps the image
so that the darkest pixel becomes black (0), and the lightest
becomes white (255).
*image*
*cutoff*
*ignore*
Returns:
**colorize(image, black, white)**
[`# <#PIL.ImageOps.colorize-function>`_]
Colorize grayscale image. The *black* and *white* arguments should
be RGB tuples; this function calculates a colour wedge mapping all
black pixels in the source image to the first colour, and all white
pixels to the second colour.
*image*
*black*
*white*
Returns:
**crop(image, border=0)** [`# <#PIL.ImageOps.crop-function>`_]
*image*
*border*
Returns:
**deform(image, deformer, resample=Image.BILINEAR)**
[`# <#PIL.ImageOps.deform-function>`_]
*image*
*deformer*
*resample*
Returns:
**equalize(image, mask=None)** [`# <#PIL.ImageOps.equalize-function>`_]
*image*
*mask*
Returns:
**expand(image, border=0, fill=0)**
[`# <#PIL.ImageOps.expand-function>`_]
*image*
*border*
*fill*
Returns:
**fit(image, size, method=Image.NEAREST, bleed=0.0, centering=(0.5,
0.5))** [`# <#PIL.ImageOps.fit-function>`_]
Returns a sized and cropped version of the image, cropped to the
requested aspect ratio and size.
The **fit** function was contributed by Kevin Cazabon.
*size*
*method*
*bleed*
*centering*
Returns:
**flip(image)** [`# <#PIL.ImageOps.flip-function>`_]
*image*
Returns:
**grayscale(image)** [`# <#PIL.ImageOps.grayscale-function>`_]
*image*
Returns:
**invert(image)** [`# <#PIL.ImageOps.invert-function>`_]
*image*
Returns:
**mirror(image)** [`# <#PIL.ImageOps.mirror-function>`_]
*image*
Returns:
**posterize(image, bits)** [`# <#PIL.ImageOps.posterize-function>`_]
*image*
*bits*
Returns:
**solarize(image, threshold=128)**
[`# <#PIL.ImageOps.solarize-function>`_]
*image*
*threshold*
Returns:

View File

@ -1,19 +0,0 @@
===========================
The PIL.ImagePalette Module
===========================
The PIL.ImagePalette Module
===========================
**ImagePalette(mode="RGB", palette=None)** (class)
[`# <#PIL.ImagePalette.ImagePalette-class>`_]
Colour palette wrapper for palette mapped images.
For more information about this class, see `*The ImagePalette
Class* <#PIL.ImagePalette.ImagePalette-class>`_.
The ImagePalette Class
----------------------
**ImagePalette(mode="RGB", palette=None)** (class)
[`# <#PIL.ImagePalette.ImagePalette-class>`_]

View File

@ -1,30 +0,0 @@
========================
The PIL.ImagePath Module
========================
The PIL.ImagePath Module
========================
**Path(xy)** (class) [`# <#PIL.ImagePath.Path-class>`_]
Path wrapper.
For more information about this class, see `*The Path
Class* <#PIL.ImagePath.Path-class>`_.
The Path Class
--------------
**Path(xy)** (class) [`# <#PIL.ImagePath.Path-class>`_]
**\_\_init\_\_(xy)** [`# <#PIL.ImagePath.Path.__init__-method>`_]
*xy*
**compact(distance=2)** [`# <#PIL.ImagePath.Path.compact-method>`_]
**getbbox()** [`# <#PIL.ImagePath.Path.getbbox-method>`_]
**map(function)** [`# <#PIL.ImagePath.Path.map-method>`_]
**tolist(flat=0)** [`# <#PIL.ImagePath.Path.tolist-method>`_]
*flat*
Returns:
**transform(matrix)** [`# <#PIL.ImagePath.Path.transform-method>`_]

View File

@ -1,23 +0,0 @@
============================
The PIL.ImageSequence Module
============================
The PIL.ImageSequence Module
============================
**Iterator(im)** (class) [`# <#PIL.ImageSequence.Iterator-class>`_]
This class implements an iterator object that can be used to loop
over an image sequence.
For more information about this class, see `*The Iterator
Class* <#PIL.ImageSequence.Iterator-class>`_.
The Iterator Class
------------------
**Iterator(im)** (class) [`# <#PIL.ImageSequence.Iterator-class>`_]
**\_\_init\_\_(im)**
[`# <#PIL.ImageSequence.Iterator.__init__-method>`_]
*im*

View File

@ -1,29 +0,0 @@
========================
The PIL.ImageStat Module
========================
The PIL.ImageStat Module
========================
The **ImageStat** module calculates global statistics for an image, or a
region of an image.
Module Contents
---------------
**Stat(image, mask=None)** (class) [`# <#PIL.ImageStat.Stat-class>`_]
Calculate statistics for the given image.
For more information about this class, see `*The Stat
Class* <#PIL.ImageStat.Stat-class>`_.
The Stat Class
--------------
**Stat(image, mask=None)** (class) [`# <#PIL.ImageStat.Stat-class>`_]
**\_\_init\_\_(image, mask=None)**
[`# <#PIL.ImageStat.Stat.__init__-method>`_]
*image*
*mask*

View File

@ -1,92 +0,0 @@
======================
The PIL.ImageTk Module
======================
The PIL.ImageTk Module
======================
The **ImageTk** module contains support to create and modify Tkinter
**BitmapImage** and **PhotoImage** objects.
For examples, see the demo programs in the *Scripts* directory.
Module Contents
---------------
**BitmapImage(image=None, \*\*options)** (class)
[`# <#PIL.ImageTk.BitmapImage-class>`_]
Create a Tkinter-compatible bitmap image.
For more information about this class, see `*The BitmapImage
Class* <#PIL.ImageTk.BitmapImage-class>`_.
**getimage(photo)** [`# <#PIL.ImageTk.getimage-function>`_]
**PhotoImage(image=None, size=None, \*\*options)** (class)
[`# <#PIL.ImageTk.PhotoImage-class>`_]
Creates a Tkinter-compatible photo image.
For more information about this class, see `*The PhotoImage
Class* <#PIL.ImageTk.PhotoImage-class>`_.
The BitmapImage Class
---------------------
**BitmapImage(image=None, \*\*options)** (class)
[`# <#PIL.ImageTk.BitmapImage-class>`_]
**\_\_init\_\_(image=None, \*\*options)**
[`# <#PIL.ImageTk.BitmapImage.__init__-method>`_]
Create a Tkinter-compatible bitmap image.
The given image must have mode "1". Pixels having value 0 are
treated as transparent. Options, if any, are passed on to Tkinter.
The most commonly used option is **foreground**, which is used to
specify the colour for the non-transparent parts. See the Tkinter
documentation for information on how to specify colours.
*image*
**\_\_str\_\_()** [`# <#PIL.ImageTk.BitmapImage.__str__-method>`_]
Returns:
**height()** [`# <#PIL.ImageTk.BitmapImage.height-method>`_]
Returns:
**width()** [`# <#PIL.ImageTk.BitmapImage.width-method>`_]
Returns:
The PhotoImage Class
--------------------
**PhotoImage(image=None, size=None, \*\*options)** (class)
[`# <#PIL.ImageTk.PhotoImage-class>`_]
**\_\_init\_\_(image=None, size=None, \*\*options)**
[`# <#PIL.ImageTk.PhotoImage.__init__-method>`_]
Create a photo image object. The constructor takes either a PIL
image, or a mode and a size. Alternatively, you can use the **file**
or **data** options to initialize the photo image object.
*image*
*size*
*file=*
*data=*
**\_\_str\_\_()** [`# <#PIL.ImageTk.PhotoImage.__str__-method>`_]
Returns:
**height()** [`# <#PIL.ImageTk.PhotoImage.height-method>`_]
Returns:
**paste(im, box=None)** [`# <#PIL.ImageTk.PhotoImage.paste-method>`_]
*im*
*box*
**width()** [`# <#PIL.ImageTk.PhotoImage.width-method>`_]
Returns:

View File

@ -1,114 +0,0 @@
=============================
The PIL.ImageTransform Module
=============================
The PIL.ImageTransform Module
=============================
**AffineTransform** (class)
[`# <#PIL.ImageTransform.AffineTransform-class>`_]
Define an affine image transform.
*matrix*
A 6-tuple (*a, b, c, d, e, f*) containing the first two rows
from an affine transform matrix.
For more information about this class, see `*The AffineTransform
Class* <#PIL.ImageTransform.AffineTransform-class>`_.
**ExtentTransform** (class)
[`# <#PIL.ImageTransform.ExtentTransform-class>`_]
Define a transform to extract a subregion from an image.
*bbox*
A 4-tuple (*x0, y0, x1, y1*) which specifies two points in the
input image's coordinate system.
For more information about this class, see `*The ExtentTransform
Class* <#PIL.ImageTransform.ExtentTransform-class>`_.
**MeshTransform** (class)
[`# <#PIL.ImageTransform.MeshTransform-class>`_]
Define an mesh image transform.
*data*
For more information about this class, see `*The MeshTransform
Class* <#PIL.ImageTransform.MeshTransform-class>`_.
**QuadTransform** (class)
[`# <#PIL.ImageTransform.QuadTransform-class>`_]
Define an quad image transform.
*xy*
An 8-tuple (*x0, y0, x1, y1, x2, y2, y3, y3*) which contain the
upper left, lower left, lower right, and upper right corner of
the source quadrilateral.
For more information about this class, see `*The QuadTransform
Class* <#PIL.ImageTransform.QuadTransform-class>`_.
The AffineTransform Class
-------------------------
**AffineTransform** (class)
[`# <#PIL.ImageTransform.AffineTransform-class>`_]
Define an affine image transform.
This function takes a 6-tuple (*a, b, c, d, e, f*) which contain the
first two rows from an affine transform matrix. For each pixel (*x,
y*) in the output image, the new value is taken from a position (a
*x* + b *y* + c, d *x* + e *y* + f) in the input image, rounded to
nearest pixel.
This function can be used to scale, translate, rotate, and shear the
original image.
*matrix*
A 6-tuple (*a, b, c, d, e, f*) containing the first two rows
from an affine transform matrix.
The ExtentTransform Class
-------------------------
**ExtentTransform** (class)
[`# <#PIL.ImageTransform.ExtentTransform-class>`_]
Define a transform to extract a subregion from an image.
Maps a rectangle (defined by two corners) from the image to a
rectangle of the given size. The resulting image will contain data
sampled from between the corners, such that (*x0, y0*) in the input
image will end up at (0,0) in the output image, and (*x1, y1*) at
*size*.
This method can be used to crop, stretch, shrink, or mirror an
arbitrary rectangle in the current image. It is slightly slower than
**crop**, but about as fast as a corresponding **resize** operation.
*bbox*
A 4-tuple (*x0, y0, x1, y1*) which specifies two points in the
input image's coordinate system.
The MeshTransform Class
-----------------------
**MeshTransform** (class)
[`# <#PIL.ImageTransform.MeshTransform-class>`_]
*data*
The QuadTransform Class
-----------------------
**QuadTransform** (class)
[`# <#PIL.ImageTransform.QuadTransform-class>`_]
Define an quad image transform.
Maps a quadrilateral (a region defined by four corners) from the
image to a rectangle of the given size.
*xy*
An 8-tuple (*x0, y0, x1, y1, x2, y2, y3, y3*) which contain the
upper left, lower left, lower right, and upper right corner of
the source quadrilateral.

View File

@ -1,107 +0,0 @@
=======================
The PIL.ImageWin Module
=======================
The PIL.ImageWin Module
=======================
**Dib(image, size=None)** (class) [`# <#PIL.ImageWin.Dib-class>`_]
Create a Windows bitmap with the given mode and size.
For more information about this class, see `*The Dib
Class* <#PIL.ImageWin.Dib-class>`_.
**HDC(dc)** (class) [`# <#PIL.ImageWin.HDC-class>`_]
The ImageWin module contains support to create and display images
under Windows 95/98, NT, 2000 and later.
For more information about this class, see `*The HDC
Class* <#PIL.ImageWin.HDC-class>`_.
**ImageWindow(image, title="PIL")** (class)
[`# <#PIL.ImageWin.ImageWindow-class>`_]
Create an image window which displays the given image.
For more information about this class, see `*The ImageWindow
Class* <#PIL.ImageWin.ImageWindow-class>`_.
**Window(title="PIL", width=None, height=None)** (class)
[`# <#PIL.ImageWin.Window-class>`_]
Create a Window with the given title size.
For more information about this class, see `*The Window
Class* <#PIL.ImageWin.Window-class>`_.
The Dib Class
-------------
**Dib(image, size=None)** (class) [`# <#PIL.ImageWin.Dib-class>`_]
Create a Windows bitmap with the given mode and size. The mode can
be one of "1", "L", "P", or "RGB". If the display requires a
palette, this constructor creates a suitable palette and associates
it with the image. For an "L" image, 128 greylevels are allocated.
For an "RGB" image, a 6x6x6 colour cube is used, together with 20
greylevels. To make sure that palettes work properly under Windows,
you must call the **palette** method upon certain events from
Windows.
**\_\_init\_\_(image, size=None)**
[`# <#PIL.ImageWin.Dib.__init__-method>`_]
*image*
*size*
**expose(handle)** [`# <#PIL.ImageWin.Dib.expose-method>`_]
*handle*
Device context (HDC), cast to a Python integer, or a HDC or HWND
instance. In PythonWin, you can use the **GetHandleAttrib**
method of the **CDC** class to get a suitable handle.
**frombytes(buffer)** [`# <#PIL.ImageWin.Dib.frombytes-method>`_]
(For Python 2.6/2.7, this is also available as fromstring(buffer).)
*buffer*
A byte buffer containing display data (usually data returned
from **tobytes**)
**paste(im, box=None)** [`# <#PIL.ImageWin.Dib.paste-method>`_]
*im*
*box*
**query\_palette(handle)**
[`# <#PIL.ImageWin.Dib.query_palette-method>`_]
Installs the palette associated with the image in the given device
context.
This method should be called upon **QUERYNEWPALETTE** and
**PALETTECHANGED** events from Windows. If this method returns a
non-zero value, one or more display palette entries were changed,
and the image should be redrawn.
*handle*
Returns:
**tobytes()** [`# <#PIL.ImageWin.Dib.tobytes-method>`_]
Returns:
The HDC Class
-------------
**HDC(dc)** (class) [`# <#PIL.ImageWin.HDC-class>`_]
The **ImageWin** module contains support to create and display
images under Windows 95/98, NT, 2000 and later.
The ImageWindow Class
---------------------
**ImageWindow(image, title="PIL")** (class)
[`# <#PIL.ImageWin.ImageWindow-class>`_]
The Window Class
----------------
**Window(title="PIL", width=None, height=None)** (class)
[`# <#PIL.ImageWin.Window-class>`_]

View File

@ -1,17 +0,0 @@
=============================
The PIL.ImtImagePlugin Module
=============================
The PIL.ImtImagePlugin Module
=============================
**ImtImageFile** (class) [`# <#PIL.ImtImagePlugin.ImtImageFile-class>`_]
Image plugin for IM Tools images.
For more information about this class, see `*The ImtImageFile
Class* <#PIL.ImtImagePlugin.ImtImageFile-class>`_.
The ImtImageFile Class
----------------------
**ImtImageFile** (class) [`# <#PIL.ImtImagePlugin.ImtImageFile-class>`_]

View File

@ -1,27 +0,0 @@
==============================
The PIL.IptcImagePlugin Module
==============================
The PIL.IptcImagePlugin Module
==============================
**getiptcinfo(im)** [`# <#PIL.IptcImagePlugin.getiptcinfo-function>`_]
*im*
Returns:
**IptcImageFile** (class)
[`# <#PIL.IptcImagePlugin.IptcImageFile-class>`_]
Image plugin for IPTC/NAA datastreams.
For more information about this class, see `*The IptcImageFile
Class* <#PIL.IptcImagePlugin.IptcImageFile-class>`_.
The IptcImageFile Class
-----------------------
**IptcImageFile** (class)
[`# <#PIL.IptcImagePlugin.IptcImageFile-class>`_]
Image plugin for IPTC/NAA datastreams. To read IPTC/NAA fields from
TIFF and JPEG files, use the **getiptcinfo** function.

View File

@ -1,19 +0,0 @@
==============================
The PIL.JpegImagePlugin Module
==============================
The PIL.JpegImagePlugin Module
==============================
**JpegImageFile** (class)
[`# <#PIL.JpegImagePlugin.JpegImageFile-class>`_]
Image plugin for JPEG and JFIF images.
For more information about this class, see `*The JpegImageFile
Class* <#PIL.JpegImagePlugin.JpegImageFile-class>`_.
The JpegImageFile Class
-----------------------
**JpegImageFile** (class)
[`# <#PIL.JpegImagePlugin.JpegImageFile-class>`_]

View File

@ -1,19 +0,0 @@
================================
The PIL.McIdasImagePlugin Module
================================
The PIL.McIdasImagePlugin Module
================================
**McIdasImageFile** (class)
[`# <#PIL.McIdasImagePlugin.McIdasImageFile-class>`_]
Image plugin for McIdas area images.
For more information about this class, see `*The McIdasImageFile
Class* <#PIL.McIdasImagePlugin.McIdasImageFile-class>`_.
The McIdasImageFile Class
-------------------------
**McIdasImageFile** (class)
[`# <#PIL.McIdasImagePlugin.McIdasImageFile-class>`_]

View File

@ -1,17 +0,0 @@
=============================
The PIL.MicImagePlugin Module
=============================
The PIL.MicImagePlugin Module
=============================
**MicImageFile** (class) [`# <#PIL.MicImagePlugin.MicImageFile-class>`_]
Image plugin for Microsoft's Image Composer file format.
For more information about this class, see `*The MicImageFile
Class* <#PIL.MicImagePlugin.MicImageFile-class>`_.
The MicImageFile Class
----------------------
**MicImageFile** (class) [`# <#PIL.MicImagePlugin.MicImageFile-class>`_]

View File

@ -1,19 +0,0 @@
==============================
The PIL.MpegImagePlugin Module
==============================
The PIL.MpegImagePlugin Module
==============================
**MpegImageFile** (class)
[`# <#PIL.MpegImagePlugin.MpegImageFile-class>`_]
Image plugin for MPEG streams.
For more information about this class, see `*The MpegImageFile
Class* <#PIL.MpegImagePlugin.MpegImageFile-class>`_.
The MpegImageFile Class
-----------------------
**MpegImageFile** (class)
[`# <#PIL.MpegImagePlugin.MpegImageFile-class>`_]

View File

@ -1,17 +0,0 @@
=============================
The PIL.MspImagePlugin Module
=============================
The PIL.MspImagePlugin Module
=============================
**MspImageFile** (class) [`# <#PIL.MspImagePlugin.MspImageFile-class>`_]
Image plugin for Windows MSP images.
For more information about this class, see `*The MspImageFile
Class* <#PIL.MspImagePlugin.MspImageFile-class>`_.
The MspImageFile Class
----------------------
**MspImageFile** (class) [`# <#PIL.MspImagePlugin.MspImageFile-class>`_]

View File

@ -1,31 +0,0 @@
========================
The PIL.OleFileIO Module
========================
The PIL.OleFileIO Module
========================
**OleFileIO(filename=None)** (class)
[`# <#PIL.OleFileIO.OleFileIO-class>`_]
This class encapsulates the interface to an OLE 2 structured storage
file.
For more information about this class, see `*The OleFileIO
Class* <#PIL.OleFileIO.OleFileIO-class>`_.
The OleFileIO Class
-------------------
**OleFileIO(filename=None)** (class)
[`# <#PIL.OleFileIO.OleFileIO-class>`_]
This class encapsulates the interface to an OLE 2 structured storage
file. Use the `**listdir** <link:listdir>`_ and
`**openstream** <link:openstream>`_ methods to access the contents
of this file.
**getproperties(filename)**
[`# <#PIL.OleFileIO.OleFileIO.getproperties-method>`_]
**listdir()** [`# <#PIL.OleFileIO.OleFileIO.listdir-method>`_]
**open(filename)** [`# <#PIL.OleFileIO.OleFileIO.open-method>`_]
**openstream(filename)**
[`# <#PIL.OleFileIO.OleFileIO.openstream-method>`_]

View File

@ -1,17 +0,0 @@
=====================
The PIL.PSDraw Module
=====================
The PIL.PSDraw Module
=====================
**PSDraw(fp=None)** (class) [`# <#PIL.PSDraw.PSDraw-class>`_]
Simple Postscript graphics interface.
For more information about this class, see `*The PSDraw
Class* <#PIL.PSDraw.PSDraw-class>`_.
The PSDraw Class
----------------
**PSDraw(fp=None)** (class) [`# <#PIL.PSDraw.PSDraw-class>`_]

View File

@ -1,17 +0,0 @@
==========================
The PIL.PaletteFile Module
==========================
The PIL.PaletteFile Module
==========================
**PaletteFile(fp)** (class) [`# <#PIL.PaletteFile.PaletteFile-class>`_]
File handler for Teragon-style palette files.
For more information about this class, see `*The PaletteFile
Class* <#PIL.PaletteFile.PaletteFile-class>`_.
The PaletteFile Class
---------------------
**PaletteFile(fp)** (class) [`# <#PIL.PaletteFile.PaletteFile-class>`_]

View File

@ -1,12 +0,0 @@
==============================
The PIL.PalmImagePlugin Module
==============================
The PIL.PalmImagePlugin Module
==============================
Module Contents
---------------
**\_save(im, fp, filename, check=0)**
[`# <#PIL.PalmImagePlugin._save-function>`_]

View File

@ -1,17 +0,0 @@
=============================
The PIL.PcdImagePlugin Module
=============================
The PIL.PcdImagePlugin Module
=============================
**PcdImageFile** (class) [`# <#PIL.PcdImagePlugin.PcdImageFile-class>`_]
Image plugin for PhotoCD images.
For more information about this class, see `*The PcdImageFile
Class* <#PIL.PcdImagePlugin.PcdImageFile-class>`_.
The PcdImageFile Class
----------------------
**PcdImageFile** (class) [`# <#PIL.PcdImagePlugin.PcdImageFile-class>`_]

Some files were not shown because too many files have changed in this diff Show More