Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 iaà�ã!@s¸ddlZddlmZyddlmZWn6ek rZZzddlmZeeƒZWYddZ[XnXdZdZ eZ dZ dZ dZ d ZdZdZdZdddBd d d d dddddddddddd„dœZdZx"ejƒD]ZeeeƒrÀeeBZqÀWGdd„dƒZGdd„dejƒZdCdd„ZGd d!„d!eƒZe dd"dfd#d$„Zd%d&„Ze dfd'd(„Z e eed)fd*d+„Z!e Z"e!Z#dDd,d-„Z$dFd.d/„Z%d0d1„Z&d2d3„Z'd4d5„Z(d6d7„Z)d8d9„Z*d:d;„Z+dd?„Z-d@dA„Z.dS)GéN)ÚImage)Ú _imagingcmsé)Údeferred_erroraz 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: https://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: 1.0.0 pil Oct 2013 Port to LCMS 2. 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 around 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 z 1.0.0 pilééééé é@éiiii ii@i€icCs |d@d>S)Néÿr ©)Únrrú-/tmp/tmp5hum_rxs/lib64/python/PIL/ImageCms.pyÚ‡sr)Z MATRIXINPUTZ MATRIXOUTPUTZ MATRIXONLYZNOWHITEONWHITEFIXUPZNOPRELINEARIZATIONZGUESSDEVICECLASSZNOTCACHEZ NOTPRECALCZ NULLTRANSFORMZHIGHRESPRECALCZ LOWRESPRECALCZWHITEBLACKCOMPENSATIONZBLACKPOINTCOMPENSATIONZ GAMUTCHECKÚ SOFTPROOFINGZ PRESERVEBLACKZNODEFAULTRESOURCEDEFZ GRIDPOINTSc@s&eZdZdd„Zddd„Zdd„ZdS) ÚImageCmsProfilecCsÂt|tƒr~tjdkrj|jƒ}y|jdƒWn>tk rht|dƒ�}|jt j |j ƒƒƒWdQRXdSX|jt j |ƒ|ƒn@t |dƒrž|jt j |j ƒƒƒn t|tjƒr¶|j|ƒntdƒ‚dS)z© :param profile: Either a string representing a filename, a file like object containing a profile or a low-level profile object Úwin32ÚasciiÚrbNÚreadzInvalid type for Profile)Ú isinstanceÚstrÚsysÚplatformÚencodeÚdecodeÚUnicodeDecodeErrorÚopenÚ_setÚcoreZprofile_frombytesrZ profile_openÚhasattrrZ CmsProfileÚ TypeError)ÚselfÚprofileZprofile_bytes_pathÚfrrrÚ__init__™s      zImageCmsProfile.__init__NcCs.||_||_|rd|_d|_n d|_d|_dS)N)r%ÚfilenameZ product_nameZ product_info)r$r%r(rrrr ²szImageCmsProfile._setcCs tj|jƒS)zŸ Returns the profile in a format suitable for embedding in saved images. :returns: a bytes object containing the ICC profile. )r!Zprofile_tobytesr%)r$rrrÚtobytes¼szImageCmsProfile.tobytes)N)Ú__name__Ú __module__Ú __qualname__r'r r)rrrrr˜s rc@s<eZdZdZededfdd„Zdd„Zd dd „Zd d „Z dS) ÚImageCmsTransformzÍ Transform. This can be used with the procedural API, or with the standard :py:func:`~PIL.Image.Image.point` method. Will return the output profile in the ``output.info['icc_profile']``. Nrc Csf|dkr$tj|j|j||||ƒ|_n tj|j|j|j|||||ƒ|_||_|_||_|_||_ dS)N) r!ÚbuildTransformr%Ú transformÚbuildProofTransformÚ input_modeZ inputModeÚ output_modeÚ outputModeÚoutput_profile) r$ÚinputÚoutputr1r2ÚintentZproofZ proof_intentÚflagsrrrr'Ðs   zImageCmsTransform.__init__cCs |j|ƒS)N)Úapply)r$ÚimrrrÚpointðszImageCmsTransform.pointcCsL|jƒ|dkr"tj|j|jdƒ}|jj|jj|jjƒ|j j ƒ|j d<|S)NÚ icc_profile) ÚloadrÚnewr2Úsizer/r9r:Úidr4r)Úinfo)r$r:ÚimOutrrrr9ós zImageCmsTransform.applycCsF|jƒ|j|jkrtdƒ‚|jj|jj|jjƒ|jj ƒ|j d<|S)Nz mode mismatchr<) r=Úmoder2Ú ValueErrorr/r9r:r@r4r)rA)r$r:rrrÚapply_in_placeûs  z ImageCmsTransform.apply_in_place)N) r*r+r,Ú__doc__ÚINTENT_PERCEPTUALÚINTENT_ABSOLUTE_COLORIMETRICr'r;r9rErrrrr-Çs  r-cCsVtjdkrdSddlm}t||jƒr4tj|dƒ}ntj|p>dƒ}|dkrNdSt|ƒS)z� (experimental) Fetches the profile for the current display device. :returns: ``None`` if the profile is not known. rNr)ÚImageWinr) rrÚPILrIrZHDCr!Zget_display_profile_win32r)ÚhandlerIr%rrrÚget_display_profiles   rLc@seZdZdZdS)Ú PyCMSErrorzJ(pyCMS) Exception class. This is used for all errors in the pyCMS API.N)r*r+r,rFrrrrrMsrMFc Cs|dkr|j}t|tƒ s4d|ko,dkn rproof (simulated) transform ImageCms.INTENT_PERCEPTUAL = 0 (DEFAULT) ImageCms.INTENT_RELATIVE_COLORIMETRIC = 1 ImageCms.INTENT_SATURATION = 2 ImageCms.INTENT_ABSOLUTE_COLORIMETRIC = 3 see the pyCMS documentation for details on rendering intents and what they do. :param proofRenderingIntent: Integer (0-3) specifying the rendering intent you wish to use for proof->output transform ImageCms.INTENT_PERCEPTUAL = 0 (DEFAULT) ImageCms.INTENT_RELATIVE_COLORIMETRIC = 1 ImageCms.INTENT_SATURATION = 2 ImageCms.INTENT_ABSOLUTE_COLORIMETRIC = 3 see the pyCMS documentation for details on rendering intents and what they do. :param flags: Integer (0-...) specifying additional flags :returns: A CmsTransform class object. :exception PyCMSError: rrz2renderingIntent must be an integer between 0 and 3z)flags must be an integer between 0 and %sN) rrNrMrOrr-rPr#rD) rQrRZ proofProfilerXrYrSZproofRenderingIntentr8rUrrrr0ës,T&&    r0cCsXy"|r|j|ƒd}n |j|ƒ}Wn0ttfk rR}zt|ƒ|‚WYdd}~XnX|S)a™ (pyCMS) Applies a transform to a given image. If ``im.mode != transform.inMode``, a :exc:`PyCMSError` is raised. If ``inPlace`` is ``True`` and ``transform.inMode != transform.outMode``, a :exc:`PyCMSError` is raised. If ``im.mode``, ``transform.inMode`` or ``transform.outMode`` is not supported by pyCMSdll or the profiles you used for the transform, a :exc:`PyCMSError` is raised. If an error occurs while the transform is being applied, a :exc:`PyCMSError` is raised. This function applies a pre-calculated transform (from ImageCms.buildTransform() or ImageCms.buildTransformFromOpenProfiles()) to an image. The transform can be used for multiple images, saving considerable calculation time if doing the same conversion multiple times. If you want to modify im in-place instead of receiving a new image as the return value, set ``inPlace`` to ``True``. This can only be done if ``transform.inMode`` and ``transform.outMode`` are the same, because we can't change the mode in-place (the buffer sizes for some modes are different). The default behavior is to return a new :py:class:`~PIL.Image.Image` object of the same dimensions in mode ``transform.outMode``. :param im: An :py:class:`~PIL.Image.Image` object, and im.mode must be the same as the ``inMode`` supported by the transform. :param transform: A valid CmsTransform class object :param inPlace: Bool. If ``True``, ``im`` is modified in place and ``None`` is returned, if ``False``, a new :py:class:`~PIL.Image.Image` object with the transform applied is returned (and ``im`` is not changed). The default is ``False``. :returns: Either ``None``, or a new :py:class:`~PIL.Image.Image` object, depending on the value of ``inPlace``. The profile will be returned in the image's ``info['icc_profile']``. :exception PyCMSError: N)rEr9r#rDrM)r:r/rTrBrUrrrÚapplyTransform^s) rZcCs¨|d krtd|›d�ƒ‚|dkrfy t|ƒ}Wn8ttfk rd}ztd|›d�ƒ|‚WYdd}~XnXy tj||ƒSttfk r¢}zt|ƒ|‚WYdd}~XnXdS) aS (pyCMS) Creates a profile. If colorSpace not in ``["LAB", "XYZ", "sRGB"]``, a :exc:`PyCMSError` is raised. If using LAB and ``colorTemp`` is not a positive integer, a :exc:`PyCMSError` is raised. If an error occurs while creating the profile, a :exc:`PyCMSError` is raised. Use this function to create common profiles on-the-fly instead of having to supply a profile on disk and knowing the path to it. It returns a normal CmsProfile object that can be passed to ImageCms.buildTransformFromOpenProfiles() to create a transform to apply to images. :param colorSpace: String, the color space of the profile you wish to create. Currently only "LAB", "XYZ", and "sRGB" are supported. :param colorTemp: Positive integer for the white point for the profile, in degrees Kelvin (i.e. 5000, 6500, 9600, etc.). The default is for D50 illuminant if omitted (5000k). colorTemp is ONLY applied to LAB profiles, and is ignored for XYZ and sRGB. :returns: A CmsProfile class object :exception PyCMSError: ÚLABÚXYZÚsRGBz;Color space not supported for on-the-fly profile creation (ú)z$Color temperature must be numeric, "z " not validN)r[r\r])rMÚfloatr#rDr!Ú createProfile)Z colorSpaceZ colorTempÚerUrrrr`“s   r`cCsžydt|tƒst|ƒ}|jj}|jj}|p*|s<|jjp6ddS| sNt|ƒdkrV|dS|›d|›d�Sttt t fk r˜}zt |ƒ|‚WYdd}~XnXdS)a  (pyCMS) Gets the internal product name for the given profile. If ``profile`` isn't a valid CmsProfile object or filename to a profile, a :exc:`PyCMSError` is raised If an error occurs while trying to obtain the name tag, a :exc:`PyCMSError` is raised. Use this function to obtain the INTERNAL name of the profile (stored in an ICC tag in the profile itself), usually the one used when the profile was originally created. Sometimes this tag also contains additional information supplied by the creator. :param profile: EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile. :returns: A string containing the internal name of the profile as stored in an ICC tag. :exception PyCMSError: ÚÚ éz - N) rrr%ÚmodelÚ manufacturerÚprofile_descriptionÚlenÚAttributeErrorrPr#rDrM)r%rerfrUrrrÚgetProfileNameÄs rjcCsŽyTt|tƒst|ƒ}|jj}|jj}g}x||fD]}|r2|j|ƒq2Wdj|ƒdSttt t fk rˆ}zt |ƒ|‚WYdd}~XnXdS)aÈ (pyCMS) Gets the internal product information for the given profile. If ``profile`` isn't a valid CmsProfile object or filename to a profile, a :exc:`PyCMSError` is raised. If an error occurs while trying to obtain the info tag, a :exc:`PyCMSError` is raised. Use this function to obtain the information stored in the profile's info tag. This often contains details about the profile, and how it was created, as supplied by the creator. :param profile: EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile. :returns: A string containing the internal profile information stored in an ICC tag. :exception PyCMSError: z N) rrr%rgÚ copyrightÚappendÚjoinrirPr#rDrM)r%Ú descriptionZcprightZarrÚeltrUrrrÚgetProfileInfoîs rpcCs\y"t|tƒst|ƒ}|jjpddSttttfk rV}zt|ƒ|‚WYdd}~XnXdS)aW (pyCMS) Gets the copyright for the given profile. If ``profile`` isn't a valid CmsProfile object or filename to a profile, a :exc:`PyCMSError` is raised. If an error occurs while trying to obtain the copyright tag, a :exc:`PyCMSError` is raised. Use this function to obtain the information stored in the profile's copyright tag. :param profile: EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile. :returns: A string containing the internal profile information stored in an ICC tag. :exception PyCMSError: rbrcN) rrr%rkrirPr#rDrM)r%rUrrrÚgetProfileCopyrights  rqcCs\y"t|tƒst|ƒ}|jjpddSttttfk rV}zt|ƒ|‚WYdd}~XnXdS)a` (pyCMS) Gets the manufacturer for the given profile. If ``profile`` isn't a valid CmsProfile object or filename to a profile, a :exc:`PyCMSError` is raised. If an error occurs while trying to obtain the manufacturer tag, a :exc:`PyCMSError` is raised. Use this function to obtain the information stored in the profile's manufacturer tag. :param profile: EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile. :returns: A string containing the internal profile information stored in an ICC tag. :exception PyCMSError: rbrcN) rrr%rfrirPr#rDrM)r%rUrrrÚgetProfileManufacturer2s  rrcCs\y"t|tƒst|ƒ}|jjpddSttttfk rV}zt|ƒ|‚WYdd}~XnXdS)aK (pyCMS) Gets the model for the given profile. If ``profile`` isn't a valid CmsProfile object or filename to a profile, a :exc:`PyCMSError` is raised. If an error occurs while trying to obtain the model tag, a :exc:`PyCMSError` is raised. Use this function to obtain the information stored in the profile's model tag. :param profile: EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile. :returns: A string containing the internal profile information stored in an ICC tag. :exception PyCMSError: rbrcN) rrr%rerirPr#rDrM)r%rUrrrÚgetProfileModelNs  rscCs\y"t|tƒst|ƒ}|jjpddSttttfk rV}zt|ƒ|‚WYdd}~XnXdS)a] (pyCMS) Gets the description for the given profile. If ``profile`` isn't a valid CmsProfile object or filename to a profile, a :exc:`PyCMSError` is raised. If an error occurs while trying to obtain the description tag, a :exc:`PyCMSError` is raised. Use this function to obtain the information stored in the profile's description tag. :param profile: EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile. :returns: A string containing the internal profile information stored in an ICC tag. :exception PyCMSError: rbrcN) rrr%rgrirPr#rDrM)r%rUrrrÚgetProfileDescriptionks  rtcCsTyt|tƒst|ƒ}|jjSttttfk rN}zt|ƒ|‚WYdd}~XnXdS)a£ (pyCMS) Gets the default intent name for the given profile. If ``profile`` isn't a valid CmsProfile object or filename to a profile, a :exc:`PyCMSError` is raised. If an error occurs while trying to obtain the default intent, a :exc:`PyCMSError` is raised. Use this function to determine the default (and usually best optimized) rendering intent for this profile. Most profiles support multiple rendering intents, but are intended mostly for one type of conversion. If you wish to use a different intent than returned, use ImageCms.isIntentSupported() to verify it will work first. :param profile: EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile. :returns: Integer 0-3 specifying the default rendering intent for this profile. ImageCms.INTENT_PERCEPTUAL = 0 (DEFAULT) ImageCms.INTENT_RELATIVE_COLORIMETRIC = 1 ImageCms.INTENT_SATURATION = 2 ImageCms.INTENT_ABSOLUTE_COLORIMETRIC = 3 see the pyCMS documentation for details on rendering intents and what they do. :exception PyCMSError: N) rrr%Zrendering_intentrirPr#rDrM)r%rUrrrÚgetDefaultIntentˆs  rucCsfy,t|tƒst|ƒ}|jj||ƒr&dSdSWn4ttttfk r`}zt|ƒ|‚WYdd}~XnXdS)a  (pyCMS) Checks if a given intent is supported. Use this function to verify that you can use your desired ``intent`` with ``profile``, and that ``profile`` can be used for the input/output/proof profile as you desire. Some profiles are created specifically for one "direction", can cannot be used for others. Some profiles can only be used for certain rendering intents, so it's best to either verify this before trying to create a transform with them (using this function), or catch the potential :exc:`PyCMSError` that will occur if they don't support the modes you select. :param profile: EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile. :param intent: Integer (0-3) specifying the rendering intent you wish to use with this profile ImageCms.INTENT_PERCEPTUAL = 0 (DEFAULT) ImageCms.INTENT_RELATIVE_COLORIMETRIC = 1 ImageCms.INTENT_SATURATION = 2 ImageCms.INTENT_ABSOLUTE_COLORIMETRIC = 3 see the pyCMS documentation for details on rendering intents and what they do. :param direction: Integer specifying if the profile is to be used for input, output, or proof INPUT = 0 (or use ImageCms.DIRECTION_INPUT) OUTPUT = 1 (or use ImageCms.DIRECTION_OUTPUT) PROOF = 2 (or use ImageCms.DIRECTION_PROOF) :returns: 1 if the intent/direction are supported, -1 if they are not. :exception PyCMSError: rNéÿÿÿÿ) rrr%Zis_intent_supportedrirPr#rDrM)r%r7Ú directionrUrrrÚisIntentSupported¯s& rxcCsttjtjjƒdtjfS)z# (pyCMS) Fetches versions. r)ÚVERSIONr!Zlittlecms_versionrÚversionÚsplitrÚ __version__rrrrÚversionsâsr}r)N)Frv)rv)/rrJrrÚ ImportErrorÚexZ_utilrZ DESCRIPTIONryr!rGZINTENT_RELATIVE_COLORIMETRICZINTENT_SATURATIONrHZDIRECTION_INPUTZDIRECTION_OUTPUTZDIRECTION_PROOFÚFLAGSrOÚvaluesÚflagrrNrZImagePointHandlerr-rLÚ ExceptionrMrVrWr.r0ZbuildTransformFromOpenProfilesZ#buildProofTransformFromOpenProfilesrZr`rjrprqrrrsrtrurxr}rrrrÚs‚  ?   /=   W Qg 5 1*('3