ó ¸ùbc@s§ddlmZdZdZddlmZddlZeZdZdZ dZ d Z dZ dZ dZidd 6dd 6dCd 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(„d)6ZdZx0ejƒD]"ZeeeƒreeBZqqWd*dDd+„ƒYZd,ejfd-„ƒYZdd.„Zd/efd0„ƒYZedddd1„Zd2„Zedd3„Zee ed#d4„ZeZ eZ!dd5„Z"dd6„Z#d7„Z$d8„Z%d9„Z&d:„Z'd;„Z(e)d<kr£dd=lm*Z*e+e,ƒxpe-e.ƒD]_Z/e+d>d?ƒe+d@e/ƒy)dAe/dUdBe0kr‡e+e0ƒnWq=e1k r›q=Xq=WndS(Eiÿÿÿÿ(tprint_functions/ pyCMS a Python / PIL interface to the littleCMS ICC Color Management System Copyright (C) 2002-2003 Kevin Cazabon kevin@cazabon.com http://www.cazabon.com pyCMS home page: http://www.cazabon.com/pyCMS littleCMS home page: http://www.littlecms.com (littleCMS is Copyright (C) 1998-2001 Marti Maria) Originally released under LGPL. Graciously donated to PIL in March 2009, for distribution under the standard PIL license The pyCMS.py module provides a "clean" interface between Python/PIL and pyCMSdll, taking care of some of the more complex handling of the direct pyCMSdll functions, as well as error-checking and making sure that all relevant data is kept together. While it is possible to call pyCMSdll functions directly, it's not highly recommended. Version History: 0.1.0 pil mod March 10, 2009 Renamed display profile to proof profile. The proof profile is the profile of the device that is being simulated, not the profile of the device which is actually used to display/print the final simulation (that'd be the output profile) - also see LCMSAPI.txt input colorspace -> using 'renderingIntent' -> proof colorspace -> using 'proofRenderingIntent' -> output colorspace Added LCMS FLAGS support. Added FLAGS["SOFTPROOFING"] as default flag for buildProofTransform (otherwise the proof profile/intent would be ignored). 0.1.0 pil March 2009 - added to PIL, as PIL.ImageCms 0.0.2 alpha Jan 6, 2002 Added try/except statements arount type() checks of potential CObjects... Python won't let you use type() on them, and raises a TypeError (stupid, if you ask me!) Added buildProofTransformFromOpenProfiles() function. Additional fixes in DLL, see DLL code for details. 0.0.1 alpha first public release, Dec. 26, 2002 Known to-do list with current version (of Python interface, not pyCMSdll): none s 0.1.0 pil(tImageNiiiit MATRIXINPUTt MATRIXOUTPUTt MATRIXONLYitNOWHITEONWHITEFIXUPitNOPRELINEARIZATIONi tGUESSDEVICECLASSi@tNOTCACHEit NOTPRECALCit NULLTRANSFORMitHIGHRESPRECALCit LOWRESPRECALCi tWHITEBLACKCOMPENSATIONtBLACKPOINTCOMPENSATIONit GAMUTCHECKi@t SOFTPROOFINGi€t PRESERVEBLACKitNODEFAULTRESOURCEDEFcCs |d@d>S(Niÿi((tn((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pytzst GRIDPOINTStImageCmsProfilecBseZd„Zdd„ZRS(cCsjtj|ƒr+|jtj|ƒ|ƒn;t|dƒrY|jtj|jƒƒƒn |j|ƒdS(Ntread(Rt isStringTypet_settcoret profile_openthasattrtprofile_frombytesR(tselftprofile((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pyt__init__‹s cCsI||_||_|r3|j|_|j|_nd|_d|_dS(N(Rtfilenamet product_namet product_infotNone(RRR!((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pyR•s    N(t__name__t __module__R R$R(((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pyR‰s tImageCmsTransformcBs;eZededd„Zd„Zdd„Zd„ZRS(ic CsŠ|dkr6tj|j|j||||ƒ|_n0tj|j|j|j|||||ƒ|_||_|_||_|_ dS(N( R$RtbuildTransformRt transformtbuildProofTransformt input_modet inputModet output_modet outputMode( RtinputtoutputR+R-tintenttprooft proof_intenttflags((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pyR ¥s   cCs |j|ƒS(N(tapply(Rtim((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pytpointºscCsY|jƒ|dkr4tj|j|jdƒ}n|jj|jj |jj ƒ}|S(N( tloadR$RtnewR-tsizeR)R5R6tid(RR6timOuttresult((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pyR5½s   !cCsP|jƒ|j|jkr+tdƒ‚n|jj|jj|jjƒ}|S(Ns mode mismatch(R8tmodeR-t ValueErrorR)R5R6R;(RR6R=((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pytapply_in_placeÄs  !N( R%R&tINTENT_PERCEPTUALR$tINTENT_ABSOLUTE_COLORIMETRICR R7R5R@(((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pyR'£s   cCsŸddl}|jdkrjddlm}t||jƒrRtj|dƒ}q•tj|padƒ}n+y tj }Wnt k r‹dSX|ƒ}t |ƒS(Niÿÿÿÿtwin32(tImageWinii( tsystplatformtPILRDt isinstancetHDCRtget_display_profile_win32t _imagingcmstget_display_profiletAttributeErrorR$R(thandleRERDRtget((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pyRLÏs    t PyCMSErrorcBseZRS((R%R&(((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pyRPçsc CsO|dkr|j}nt|tƒ sEd|ko?dkn rTtdƒ‚nt|tƒ sd|ko{tkn r”tdtƒ‚nyŒt|tƒsµt|ƒ}nt|tƒsÓt|ƒ}nt|||j||d|ƒ}|r|j|ƒd}n|j |ƒ}Wn(t t t fk rJ} t| ƒ‚nX|S(Niis2renderingIntent must be an integer between 0 and 3s)flags must be an integer between 0 and %sR4( R$R>RHtintRPt _MAX_FLAGRR'R@R5tIOErrort TypeErrorR?( R6t inputProfilet outputProfiletrenderingIntentR.tinPlaceR4R)R<tv((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pytprofileToProfiles(  --  cCs=yt|ƒSWn(tttfk r8}t|ƒ‚nXdS(N(RRSRTR?RP(tprofileFilenameRY((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pytgetOpenProfileBsc Cst|tƒ s-d|ko'dkn r<tdƒ‚nt|tƒ sid|koctkn r|tdtƒ‚ny\t|tƒst|ƒ}nt|tƒs»t|ƒ}nt|||||d|ƒSWn(tttfk r}t|ƒ‚nXdS(Niis2renderingIntent must be an integer between 0 and 3s)flags must be an integer between 0 and %sR4( RHRQRPRRRR'RSRTR?(RURVtinModetoutModeRWR4RY((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pyR(}s-- c Cs(t|tƒ s-d|ko'dkn r<tdƒ‚nt|tƒ sid|koctkn r|tdtƒ‚ny}t|tƒst|ƒ}nt|tƒs»t|ƒ}nt|tƒsÙt|ƒ}nt||||||||ƒSWn(tttfk r#}t|ƒ‚nXdS(Niis2renderingIntent must be an integer between 0 and 3s)flags must be an integer between 0 and %s( RHRQRPRRRR'RSRTR?( RURVt proofProfileR]R^RWtproofRenderingIntentR4RY((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pyR*Ôs--#cCs[y/|r|j|ƒd}n|j|ƒ}Wn%ttfk rV}t|ƒ‚nX|S(N(R@R$R5RTR?RP(R6R)RXR<RY((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pytapplyTransform s  cCs²|dkrtd|ƒ‚n|dkrrt|tƒrMt|dƒ}nt|tƒsrtd|ƒ‚qrnytj||ƒSWn%ttfk r­}t|ƒ‚nXdS(NtLABtXYZtsRGBs>Color space not supported for on-the-fly profile creation (%s)gà?s<Color temperature must be a positive integer, "%s" not valid(RbRcRd(RPRHtfloatRQRt createProfileRTR?(t colorSpacet colorTempRY((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pyRf1s  cCsby0t|tƒs!t|ƒ}n|jjdSWn+ttttfk r]}t|ƒ‚nXdS(Ns ( RHRRR"RMRSRTR?RP(RRY((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pytgetProfileNameRs cCs_y-t|tƒs!t|ƒ}n|jdSWn+ttttfk rZ}t|ƒ‚nXdS(Ns (RHRR#RMRSRTR?RP(RRY((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pytgetProfileInfons cCs^y,t|tƒs!t|ƒ}n|jjSWn+ttttfk rY}t|ƒ‚nXdS(N( RHRRtrendering_intentRMRSRTR?RP(RRY((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pytgetDefaultIntent’s cCsqy?t|tƒs!t|ƒ}n|jj||ƒr:dSdSWn+ttttfk rl}t|ƒ‚nXdS(Niiÿÿÿÿ( RHRRtis_intent_supportedRMRSRTR?RP(RR1t directionRY((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pytisIntentSupported½scCs/ddl}ttj|jjƒdtjfS(Niÿÿÿÿi(REtVERSIONRtlittlecms_versiontversiontsplitR(RE((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pytversionsÍs t__main__(tImageCmst=iPs%ssdoc = ImageCms.%s.__doc__tpyCMSi((2t __future__Rt DESCRIPTIONRpRGRRKRRAtINTENT_RELATIVE_COLORIMETRICtINTENT_SATURATIONRBtDIRECTION_INPUTtDIRECTION_OUTPUTtDIRECTION_PROOFtFLAGSRRtvaluestflagRHRQRtImagePointHandlerR'R$RLt ExceptionRPRZR\R(R*tbuildTransformFromOpenProfilest#buildProofTransformFromOpenProfilesRaRfRiRjRlRoRtR%Rvtprintt__doc__tdirRxtftdocRM(((s2/usr/lib64/python2.7/site-packages/PIL/ImageCms.pyts€<   , 1* ;W& $ !  $ +