Docs for profile additions

This commit is contained in:
wiredfool 2014-08-02 21:22:51 -07:00
parent 5966278643
commit 6538d971e2

View File

@ -150,8 +150,13 @@ for flag in FLAGS.values():
class ImageCmsProfile: class ImageCmsProfile:
def __init__(self, profile): def __init__(self, profile):
# accepts a string (filename), a file-like object, or a low-level """
# profile object :param profile: Either a string representing a filename,
a file like object containing a profile or a
low-level profile object
"""
if isStringType(profile): if isStringType(profile):
self._set(core.profile_open(profile), profile) self._set(core.profile_open(profile), profile)
elif hasattr(profile, "read"): elif hasattr(profile, "read"):
@ -170,13 +175,22 @@ class ImageCmsProfile:
self.product_info = None self.product_info = None
def tobytes(self): def tobytes(self):
"""
Returns the profile in a format suitable for embedding in
saved images.
:returns: a bytes object containing the ICC profile.
"""
return core.profile_tobytes(self.profile) return core.profile_tobytes(self.profile)
class ImageCmsTransform(Image.ImagePointHandler): class ImageCmsTransform(Image.ImagePointHandler):
"""Transform. This can be used with the procedural API, or with the # Transform. This can be used with the procedural API, or with the
standard Image.point() method. # standard Image.point() method.
""" #
# Will return the output profile in the output.info['icc_profile'].
def __init__(self, input, output, input_mode, output_mode, def __init__(self, input, output, input_mode, output_mode,
intent=INTENT_PERCEPTUAL, proof=None, intent=INTENT_PERCEPTUAL, proof=None,
@ -576,7 +590,7 @@ def applyTransform(im, transform, inPlace=0):
with the transform applied is returned (and im is not changed). The with the transform applied is returned (and im is not changed). The
default is False. default is False.
:returns: Either None, or a new PIL Image object, depending on the value of :returns: Either None, or a new PIL Image object, depending on the value of
inPlace inPlace. The profile will be returned in the image's info['icc_profile'].
:exception PyCMSError: :exception PyCMSError:
""" """