示例#1
0
def cms_create_proofing_transform(inputProfile, inMode,
							outputProfile, outMode,
							proofingProfile,
							renderingIntent=uc2const.INTENT_PERCEPTUAL,
							proofingIntent=uc2const.INTENT_RELATIVE_COLORIMETRIC,
							flags=uc2const.cmsFLAGS_SOFTPROOFING):
	"""
	Returns a handle to lcms transformation wrapped as a Python object.

	inputProfile - a valid lcms profile handle
	outputProfile - a valid lcms profile handle
	proofingProfile - a valid lcms profile handle 
	inMode - predefined string constant (i.e. TYPE_RGB_8, TYPE_RGBA_8, TYPE_CMYK_8, etc.) or valid PIL mode		
	outMode - predefined string constant (i.e. TYPE_RGB_8, TYPE_RGBA_8, TYPE_CMYK_8, etc.) or valid PIL mode		
	renderingIntent - integer constant (0-3) specifying rendering intent for the transform
	proofingIntent - integer constant (0-3) specifying proofing intent for the transform
	flags - a set of predefined lcms flags
	"""

	if renderingIntent not in (0, 1, 2, 3):
		raise CmsError, "renderingIntent must be an integer between 0 and 3"

	if proofingIntent not in (0, 1, 2, 3):
		raise CmsError, "proofingIntent must be an integer between 0 and 3"

	result = _cms.buildProofingTransform(inputProfile, inMode, outputProfile, outMode,
										proofingProfile, renderingIntent, proofingIntent, flags)

	if result is None:
		raise CmsError, "Cannot create requested proofing transform: %s %s" % (inMode, outMode)

	return result
示例#2
0
def cms_create_proofing_transform(in_profile, in_mode, out_profile, out_mode,
                                  proof_profile,
                                  intent=uc2const.INTENT_PERCEPTUAL,
                                  pintent=uc2const.INTENT_RELATIVE_COLORIMETRIC,
                                  flags=uc2const.cmsFLAGS_SOFTPROOFING):
    """Returns a handle to lcms transformation wrapped as a Python object.

    :param in_profile: valid lcms profile handle
    :param in_mode: valid lcms or PIL mode
    :param out_profile: valid lcms profile handle
    :param out_mode: valid lcms or PIL mode
    :param proof_profile: valid lcms profile handle
    :param intent: integer constant (0-3) of transform rendering intent
    :param pintent: integer constant (0-3) of transform proofing intent
    :param flags: lcms flags

    :return: handle to lcms transformation
    """

    if intent not in INTENTS:
        raise CmsError('Rendering intent must be an integer between 0 and 3')

    if pintent not in INTENTS:
        raise CmsError('Proofing intent must be an integer between 0 and 3')

    result = _cms.buildProofingTransform(in_profile, in_mode,
                                         out_profile, out_mode,
                                         proof_profile, intent,
                                         pintent, flags)

    if result is None:
        msg = 'Cannot create requested proofing transform'
        raise CmsError("%s: %s %s" % (msg, in_mode, out_mode))

    return result
示例#3
0
def cms_create_proofing_transform(
        inputProfile,
        inMode,
        outputProfile,
        outMode,
        proofingProfile,
        renderingIntent=uc2const.INTENT_PERCEPTUAL,
        proofingIntent=uc2const.INTENT_RELATIVE_COLORIMETRIC,
        flags=uc2const.cmsFLAGS_SOFTPROOFING):
    """
	Returns a handle to lcms transformation wrapped as a Python object.

	inputProfile - a valid lcms profile handle
	outputProfile - a valid lcms profile handle
	proofingProfile - a valid lcms profile handle 
	inMode - predefined string constant 
			(i.e. TYPE_RGB_8, TYPE_RGBA_8, TYPE_CMYK_8, etc.) or valid PIL mode		
	outMode - predefined string constant 
			(i.e. TYPE_RGB_8, TYPE_RGBA_8, TYPE_CMYK_8, etc.) or valid PIL mode		
	renderingIntent - integer constant (0-3) specifying rendering intent 
			for the transform
	proofingIntent - integer constant (0-3) specifying proofing intent 
			for the transform
	flags - a set of predefined lcms flags
	"""

    if renderingIntent not in (0, 1, 2, 3):
        raise CmsError, 'renderingIntent must be an integer between 0 and 3'

    if proofingIntent not in (0, 1, 2, 3):
        raise CmsError, 'proofingIntent must be an integer between 0 and 3'

    result = _cms.buildProofingTransform(inputProfile, inMode, outputProfile,
                                         outMode, proofingProfile,
                                         renderingIntent, proofingIntent,
                                         flags)

    if result is None:
        msg = 'Cannot create requested proofing transform'
        raise CmsError, msg + ': %s %s' % (inMode, outMode)

    return result