Ejemplo n.º 1
0
    def __init__(self, rgb_profile_name, cmyk_profile_name):
        self._rgb_profile_name = rgb_profile_name
        self._cmyk_profile_name = cmyk_profile_name

        print self._rgb_profile_name, self._cmyk_profile_name
        
        self.RGB_profile   = lcms.cmsOpenProfileFromFile(self._rgb_profile_name, "r")
        self.CMYK_profile  = lcms.cmsOpenProfileFromFile(self._cmyk_profile_name, "r")

        self.RGB2CMYK_transform = lcms.cmsCreateTransform(self.RGB_profile,
                                                          lcms.TYPE_RGB_8,
                                                          self.CMYK_profile,
                                                          lcms.TYPE_CMYK_8,
                                                          lcms.INTENT_PERCEPTUAL,
                                                          lcms.cmsFLAGS_NOTPRECALC)
Ejemplo n.º 2
0
	def refresh_profiles(self):
		if app.config.preferences.user_rgb_profile and os.path.isfile(app.config.preferences.user_rgb_profile):
			rgb_file=app.config.user_rgb_profile
		else:
			rgb_file=os.path.join(app.config.sk_icc, app.config.preferences.default_rgb_profile)
			
		if app.config.preferences.user_cmyk_profile and os.path.isfile(app.config.preferences.user_cmyk_profile):
			cmyk_file=app.config.preferences.user_cmyk_profile
		else:
			cmyk_file=os.path.join(app.config.sk_icc, app.config.preferences.default_cmyk_profile)
			
		if app.config.preferences.user_monitor_profile and os.path.isfile(app.config.preferences.user_monitor_profile):
			monitor_file=app.config.preferences.user_monitor_profile
		else:
			monitor_file=os.path.join(app.config.sk_icc, app.config.preferences.default_monitor_profile)
		
		self.hRGB   = cmsOpenProfileFromFile(rgb_file, "r")
		self.hCMYK  = cmsOpenProfileFromFile(cmyk_file, "r")
		self.hMONITOR  = cmsOpenProfileFromFile(cmyk_file, "r")
	
		self.cmyk_rgb = cmsCreateTransform(self.hCMYK, 
								   TYPE_CMYK_8, 
								   self.hRGB, 
								   TYPE_RGB_8, 
								   INTENT_RELATIVE_COLORIMETRIC,
								   #INTENT_PERCEPTUAL, 
								   cmsFLAGS_NOTPRECALC)		
		
		self.rgb_cmyk = cmsCreateTransform(self.hRGB, 
								   TYPE_RGB_8,
								   self.hCMYK, 
								   TYPE_CMYK_8,  
								   INTENT_PERCEPTUAL, 
								   cmsFLAGS_NOTPRECALC)			
		
		self.rgb_monitor = cmsCreateTransform(self.hRGB, 
								   TYPE_RGB_8,
								   self.hRGB, 
								   TYPE_RGB_8,  
								   INTENT_PERCEPTUAL, 0)			
		
		self.cmyk_monitor = cmsCreateTransform(self.hCMYK, 
								   TYPE_CMYK_8,
								   self.hRGB, 
								   TYPE_RGB_8,  
								   INTENT_PERCEPTUAL, 
								   cmsFLAGS_NOTPRECALC)
Ejemplo n.º 3
0
    lcms.cmsWhitePointFromTemp(6504, D65)
    lab_profile = lcms.cmsCreateLabProfile(D65)
    rgb_profile = lcms.cmsCreate_sRGBProfile()

    lcms.cmsSetAlarmCodes(127, 127, 127)

    xyz2rgb = lcms.cmsCreateTransform(xyz_profile, lcms.TYPE_XYZ_DBL,
                                      rgb_profile, lcms.TYPE_RGB_8,
                                      lcms.INTENT_PERCEPTUAL, 0)

    rgb2xyz = lcms.cmsCreateTransform(rgb_profile, lcms.TYPE_RGB_8,
                                      xyz_profile, lcms.TYPE_XYZ_DBL,
                                      lcms.INTENT_PERCEPTUAL, 0)

    if exists("proofing.icc"):
        proofing_profile = lcms.cmsOpenProfileFromFile("proofing.icc", "r")
        lab2rgb = lcms.cmsCreateProofingTransform(
            lab_profile, lcms.TYPE_Lab_DBL, rgb_profile, lcms.TYPE_RGB_8,
            proofing_profile, lcms.INTENT_PERCEPTUAL, lcms.INTENT_PERCEPTUAL,
            lcms.cmsFLAGS_GAMUTCHECK | lcms.cmsFLAGS_SOFTPROOFING)
    else:
        lab2rgb = lcms.cmsCreateTransform(lab_profile, lcms.TYPE_Lab_DBL,
                                          rgb_profile, lcms.TYPE_RGB_8,
                                          lcms.INTENT_PERCEPTUAL, 0)

    rgb2lab = lcms.cmsCreateTransform(rgb_profile, lcms.TYPE_RGB_8,
                                      lab_profile, lcms.TYPE_Lab_DBL,
                                      lcms.INTENT_PERCEPTUAL, 0)

    def lab_to_rgb(l, a, b):
        lab = lcms.cmsCIELab(l, a, b)