Exemple #1
0
def cms_open_profile_from_file(profileFilename, mode=None):
	"""	
	Returns a handle to lcms profile wrapped as a Python object. 
	The handle doesn't require to be closed after usage because
	on object delete operation Python calls native cms_close_profile()
	function automatically  

	profileFilename - a valid filename path to the ICC profile
	mode - stub parameter for python-lcms compatibility
	"""
	if not os.path.isfile(profileFilename):
		raise CmsError, "Invalid profile path provided: %s" % profileFilename

	result = _cms.openProfile(profileFilename)

	if result is None:
		raise CmsError, "It seems provided profile is invalid: %s" % profileFilename

	return result
Exemple #2
0
def cms_open_profile_from_file(profile_path):
    """Returns a handle to lcms profile wrapped as a Python object.
    The handle doesn't require to be closed after usage because
    on object delete operation Python calls native cms_close_profile()
    function automatically

    :param profile_path: a valid filename path to the ICC profile
    :return: handle to lcms profile
    """
    if not os.path.isfile(profile_path):
        raise CmsError('Invalid profile path provided: %s' % profile_path)

    result = _cms.openProfile(profile_path)

    if result is None:
        msg = 'It seems provided profile is invalid'
        raise CmsError(msg + ': %s' % profile_path)

    return result
def cmsOpenProfileFromFile(profileFilename, mode=None):
    """	
	Returns a handle to lcms profile wrapped as a Python object. 
	The handle doesn't require to be closed after usage because
	on object delete operation Python calls native cmsCloseProfile()
	function automatically  

	profileFilename - a valid filename path to the ICC profile
	mode - stub parameter for python-lcms compatibility
	"""
    if not os.path.isfile(profileFilename):
        raise cmsError, "Invalid profile path provided: %s" % profileFilename

    result = _cms.openProfile(profileFilename)

    if result is None:
        raise cmsError, "It seems provided profile is invalid: %s" % profileFilename

    return result