Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
ImageCms.cpython-313.pyc620 linesDownload Raw Back to __pycache__
1�

2v�j���(�SSKJr SSKrSSKrSSKJrJr SSKJr SSK	J3r4JrJrJ
r
Jr SSKJr SSKJr SS	KJr SS5KJr \\\\\R2S4rS
r Sr!"SS\5r""SS\5r#"SS\5r$\"\RJ\$5r&0SS_SS_SS_SS_SS_SS_S S!_S"S#_S$S%_S&S'_S(S)_S*S+_S,S+_S-S._S/S0_S1S2_S3S4_S5S60Er'"S7S5r("S8S9\RR5r*SLSMS:jjr+"S;S<\,5r-\"R\SS=\$R^4SNS>jjr0SOS?jr1\"R\\$R^4SPS@jjr2\"R\\"Rf\$Rh4SQSAjjr5\2r6\5r7SRSSSBjjr8STSUSCjjr9SVSDjr:SVSEjr;SVSFjr<SVSGjr=SVSHjr>SVSIjr?SWSJjr@SXSKjrAg!\a#rSSKJr \R>"\5rSrCGN�SrCff=f)Y�)�annotationsN)�IntEnum�IntFlag)�reduce)�Any�Literal�
SupportsFloat�SupportsInt�Union�)�Image)�	deprecate)�SupportsRead)�_imagingcms�ImageCmsProfile)�
DeferredErrora|	6pyCMS7 8    a Python / PIL interface to the littleCMS ICC Color Management System9    Copyright (C) 2002-2003 Kevin Cazabon10    kevin@cazabon.com11    https://www.cazabon.com12 13    pyCMS home page:  https://www.cazabon.com/pyCMS14    littleCMS home page:  https://www.littlecms.com15    (littleCMS is Copyright (C) 1998-2001 Marti Maria)16 17    Originally released under LGPL.  Graciously donated to PIL in18    March 2009, for distribution under the standard PIL license19 20    The pyCMS.py module provides a "clean" interface between Python/PIL and21    pyCMSdll, taking care of some of the more complex handling of the direct22    pyCMSdll functions, as well as error-checking and making sure that all23    relevant data is kept together.24 25    While it is possible to call pyCMSdll functions directly, it's not highly26    recommended.27 28    Version History:29 30        1.0.0 pil       Oct 2013 Port to LCMS 2.31 32        0.1.0 pil mod   March 10, 200933 34                        Renamed display profile to proof profile. The proof35                        profile is the profile of the device that is being36                        simulated, not the profile of the device which is37                        actually used to display/print the final simulation38                        (that'd be the output profile) - also see LCMSAPI.txt39                        input colorspace -> using 'renderingIntent' -> proof40                        colorspace -> using 'proofRenderingIntent' -> output41                        colorspace42 43                        Added LCMS FLAGS support.44                        Added FLAGS["SOFTPROOFING"] as default flag for45                        buildProofTransform (otherwise the proof profile/intent46                        would be ignored).47 48        0.1.0 pil       March 2009 - added to PIL, as PIL.ImageCms49 50        0.0.2 alpha     Jan 6, 200251 52                        Added try/except statements around type() checks of53                        potential CObjects... Python won't let you use type()54                        on them, and raises a TypeError (stupid, if you ask55                        me!)56 57                        Added buildProofTransformFromOpenProfiles() function.58                        Additional fixes in DLL, see DLL code for details.59 60        0.0.1 alpha     first public release, Dec. 26, 200261 62    Known to-do list with current version (of Python interface, not pyCMSdll):63 64        none65 66z	1.0.0 pilc�$�\rSrSrSrSrSrSrSrg)�Intent�vrr���N)	�__name__�67__module__�__qualname__�__firstlineno__�68PERCEPTUAL�RELATIVE_COLORIMETRIC�69SATURATION�ABSOLUTE_COLORIMETRIC�__static_attributes__r��RD:\code\apps\devtools\python\user_packages\Python313\site-packages\PIL/ImageCms.pyrrvs���J����J��r"rc� �\rSrSrSrSrSrSrg)�	Direction�}rrrrN)rrrr�INPUT�OUTPUT�PROOFr!rr"r#r%r%}s��
�E�
�F�
�Er"r%c��\rSrSrSrSrSrSrSrSr	Sr70S	rS71rSr
SrS
rSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSr\ S!Sj5r!Sr"g )"�Flags�z3Flags and documentation are taken from ``lcms2.h``.r�@����@� ����� �rr���i�iiiiii i@i�c�4�[RUS-S--$)zc72Fine-tune control over number of gridpoints73 74:param n: :py:class:`int` in range ``0 <= n <= 255``75��r9)r+�NONE��ns r#�76GRIDPOINTS�Flags.GRIDPOINTS�s���z�z�a�$�h�2�-�.�.r"rN)r@�int�returnr+)#rrrr�__doc__r>�NOCACHE�77NOOPTIMIZE�
NULLTRANSFORM�78GAMUTCHECK�SOFTPROOFING�BLACKPOINTCOMPENSATION�NOWHITEONWHITEFIXUP�HIGHRESPRECALC�
LOWRESPRECALC�USE_8BITS_DEVICELINK�GUESSDEVICECLASS�
KEEP_SEQUENCE�79FORCE_CLUT�CLUT_POST_LINEARIZATION�CLUT_PRE_LINEARIZATION�NONEGATIVES�80COPY_ALPHA�NODEFAULTRESOURCEDEF�
_GRIDPOINTS_1�
_GRIDPOINTS_2�
_GRIDPOINTS_4�
_GRIDPOINTS_8�_GRIDPOINTS_16�_GRIDPOINTS_32�_GRIDPOINTS_64�_GRIDPOINTS_128�staticmethodrAr!rr"r#r+r+�s���=��D��G���J���M� ��J���L��#�� ����N�1��M�/�!��#���;��M�7��J�!�$��5�#��4��K�?��J�;�%���M��M��M��M��N��N��N��O��/��/r"r+�MATRIXINPUT�MATRIXOUTPUTr�81MATRIXONLYrrLr3�NOPRELINEARIZATIONr9rPr7�NOTCACHEr-�82NOTPRECALCr.rHr/rMr4rNr5�WHITEBLACKCOMPENSATIONr2rKrIr0rJr1�
PRESERVEBLACKr:rWr;rAc��US-S-$)Nr=r9rr?s r#�<lambda>rj�s
��Q��X�"�,r"c�2�\rSrSrSSjrSSjrS	SjrSrg)83r��c��SUl[U[5(aX[RS:Xa"UR5nUR
S5 Xl[R"U5Ulg[US5(a*[R"UR55Ulg[U[R5(aXlgSn[!U5e![aS [US5n[R"UR55UlSSS5 O!,(df   O=fgf=f)z�84:param profile: Either a string representing a filename,85    a file like object containing a profile or a86    low-level profile object87 88N�win32�ascii�rb�readzInvalid type for Profile)�filename�89isinstance�str�sys�platform�encode�decode�UnicodeDecodeError�open�core�profile_frombytesrq�profile�profile_open�hasattr�90CmsProfile�	TypeError)�selfr}�profile_bytes_path�f�msgs     r#�__init__�ImageCmsProfile.__init__�s���%)��
��g�s�#�#��|�|�w�&�%,�^�^�%5�"��&�-�-�g�6�91$�M��,�,�W�5�D�L�
�W�f�
%�
%��1�1�'�,�,�.�A�D�L�
�����
1�
1�"�L�,�C��C�.� ��*���g�t�,��'+�'=�'=�a�f�f�h�'G���-�,�,����s*�C#�#E�9*D,�#	E�,92D:	�6E�?Ec�~�US;a[SU3S5 gSURRSUS3n[U5e)N)�product_name�product_infozImageCms.ImageCmsProfile.�
�'z' object has no attribute ')r�	__class__r�AttributeError)r��namer�s   r#�__getattr__�ImageCmsProfile.__getattr__sK���3�3��1�$��8�"�=���$�.�.�)�)�*�*E�d�V�1�M���S�!�!r"c�B�[R"UR5$)z93Returns the profile in a format suitable for embedding in94saved images.95 96:returns: a bytes object containing the ICC profile.97)r{�profile_tobytesr})r�s r#�tobytes�ImageCmsProfile.tobytes	s���#�#�D�L�L�1�1r")rrr}N)r}�+str | SupportsRead[bytes] | core.CmsProfilerD�None)r�rtrDr)rD�bytes)rrrrr�r�r�r!rr"r#rr�s��!�8"�2r"c��\rSrSrSr\RS\R\R4S	Sjjr98S99SjrSSSjjrS100Sjr
Srg)
�ImageCmsTransformiz�101Transform.  This can be used with the procedural API, or with the standard102:py:func:`~PIL.Image.Image.point` method.103 104Will return the output profile in the ``output.info['icc_profile']``.105Nc	106�4�Uc3[R"URURX4XX5UlO@[R"URURURUUUUU5UlU=UlUlU=UlUlX l	g�N)107r{�buildTransformr}�	transform�buildProofTransform�108input_mode�	inputMode�output_mode�109outputMode�output_profile)	r��input�outputr�r��intent�proof�proof_intent�flagss	         r#r��ImageCmsTransform.__init__s����=�!�0�0��
�
�v�~�~�z���D�N�"�5�5��
�
�����
�
������	�D�N�,6�5���$�.�-8�8���4�?�$�r"c�$�URU5$r�)�apply)r��ims  r#�point�ImageCmsTransform.point<s���z�z�"�~�r"c�"�Uc,[R"URURS5nURRUR
5UR
55 URR5URS'U$)N�icc_profile)110r
�newr��sizer�r��getimr�r��info)r�r��imOuts   r#r��ImageCmsTransform.apply?se���=��I�I�d�.�.�����>�E������R�X�X�Z�����7�$(�$7�$7�$?�$?�$A��111�112�=�!��r"c��URUR:wa
Sn[U5eURR	UR5UR55 URR5URS'U$)Nz
mode mismatchr�)	�moder��113ValueErrorr�r�r�r�r�r�)r�r�r�s   r#�apply_in_place� ImageCmsTransform.apply_in_placeFse��
�7�7�d�&�&�&�!�C��S�/�!������R�X�X�Z�����4�!%�!4�!4�!<�!<�!>����
���	r")r�r�r�r�r�r�)r�rr�rr�rtr�rtr�rr��ImageCmsProfile | Noner�rr�r+)r��Image.ImagerDr�r�)r�r�r��Image.Image | NonerDr�)rrrrrErrr r+r>r�r�r�r�r!rr"r#r�r�s���� �*�*�(,�%�;�;��z�z�%��%� �%��	%�114�%��
%�&�%��%��%�@��r"r�c��[RS:wagSSKJn [	XR1155(a![R"[U5S5nO([R"[U=(d S55nUcg[U5$)zu116(experimental) Fetches the profile for the current display device.117 118:returns: ``None`` if the profile is not known.119rnNr)�ImageWinr)120rurv�r�rs�HDCr{�get_display_profile_win32rCr)�handler�r}s   r#�get_display_profiler�Osg���|�|�w�����&�,�,�'�'��0�0��V��a�@���0�0��V�[�q�1A�B������7�#�#r"c��\rSrSrSrSrg)�121PyCMSErroriizF(pyCMS) Exception class.122This is used for all errors in the pyCMS API.rN)rrrrrEr!rr"r#r�r�is��5�	r"r�Fc	�^�UcURn[U[5(aSUs=::aS::dO Sn[U5e[U[5(aSUs=::a123[::dO S[3n[U5e[U[1245(d[U5n[U[1255(d[U5n[
UUURUUUS9nU(aURU5 Sn	U	$URU5n	U	$![[[4an126[U1275U128eSn129A130ff=f)a�	131(pyCMS) Applies an ICC transformation to a given image, mapping from132``inputProfile`` to ``outputProfile``.133 134If the input or output profiles specified are not valid filenames, a135:exc:`PyCMSError` will be raised.  If ``inPlace`` is ``True`` and136``outputMode != im.mode``, a :exc:`PyCMSError` will be raised.137If an error occurs during application of the profiles,138a :exc:`PyCMSError` will be raised.139If ``outputMode`` is not a mode supported by the ``outputProfile`` (or by pyCMS),140a :exc:`PyCMSError` will be raised.141 142This function applies an ICC transformation to im from ``inputProfile``'s143color space to ``outputProfile``'s color space using the specified rendering144intent to decide how to handle out-of-gamut colors.145 146``outputMode`` can be used to specify that a color mode conversion is to147be done using these profiles, but the specified profiles must be able148to handle that mode.  I.e., if converting im from RGB to CMYK using149profiles, the input profile must handle RGB data, and the output150profile must handle CMYK data.151 152:param im: An open :py:class:`~PIL.Image.Image` object (i.e. Image.new(...)153    or Image.open(...), etc.)154:param inputProfile: String, as a valid filename path to the ICC input155    profile you wish to use for this image, or a profile object156:param outputProfile: String, as a valid filename path to the ICC output157    profile you wish to use for this image, or a profile object158:param renderingIntent: Integer (0-3) specifying the rendering intent you159    wish to use for the transform160 161        ImageCms.Intent.PERCEPTUAL            = 0 (DEFAULT)162        ImageCms.Intent.RELATIVE_COLORIMETRIC = 1163        ImageCms.Intent.SATURATION            = 2164        ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3165 166    see the pyCMS documentation for details on rendering intents and what167    they do.168:param outputMode: A valid PIL mode for the output image (i.e. "RGB",169    "CMYK", etc.).  Note: if rendering the image "inPlace", outputMode170    MUST be the same mode as the input, or omitted completely.  If171    omitted, the outputMode will be the same as the mode of the input172    image (im.mode)173:param inPlace: Boolean.  If ``True``, the original image is modified in-place,174    and ``None`` is returned.  If ``False`` (default), a new175    :py:class:`~PIL.Image.Image` object is returned with the transform applied.176:param flags: Integer (0-...) specifying additional flags177:returns: Either None or a new :py:class:`~PIL.Image.Image` object, depending on178    the value of ``inPlace``179:exception PyCMSError:180Nrr�2renderingIntent must be an integer between 0 and 3�'flags must be an integer between 0 and �r�)r�rsrCr��	_MAX_FLAGrr�r�r��OSErrorr�r�)r��inputProfile�
outputProfile�renderingIntentr��inPlacer�r�r�r��vs           r#�profileToProfiler�ps��z���W�W�181��o�s�+�+�A��4M�A�4M�B����o���e�S�!�!�!�u�*A�	�*A�7�	�{�C����o��#��,��8�8�*�<�8�L��-��9�9�+�M�:�M�%����G�G����
182�	���$�$�R�(��E��L�	�O�O�B�'�E��L��
�Y�183�+�#���m��"��#�s�>A2D�2D�D,�D'�'D,c�l�[U5$![[[4an[	U5UeSnAff=f)a�184(pyCMS) Opens an ICC profile file.185 186The PyCMSProfile object can be passed back into pyCMS for use in creating187transforms and such (as in ImageCms.buildTransformFromOpenProfiles()).188 189If ``profileFilename`` is not a valid filename for an ICC profile,190a :exc:`PyCMSError` will be raised.191 192:param profileFilename: String, as a valid filename path to the ICC profile193    you wish to open, or a file-like object.194:returns: A CmsProfile class object.195:exception PyCMSError:196N)rr�r�r�r�)�profileFilenamer�s  r#�getOpenProfiler��s5��$#���/�/���Y�197�+�#���m��"��#�s�198
�3�.�3c	���[U[5(aSUs=::aS::dO Sn[U5e[U[5(aSUs=::a199[::dO S[3n[U5e[U[5(d[	U5n[U[5(d[	U5n[XX#XES9$![[[4an[U5UeSnAff=f)aN200201(pyCMS) Builds an ICC transform mapping from the ``inputProfile`` to the202``outputProfile``. Use applyTransform to apply the transform to a given203image.204 205If the input or output profiles specified are not valid filenames, a206:exc:`PyCMSError` will be raised. If an error occurs during creation207of the transform, a :exc:`PyCMSError` will be raised.208 209If ``inMode`` or ``outMode`` are not a mode supported by the ``outputProfile``210(or by pyCMS), a :exc:`PyCMSError` will be raised.211 212This function builds and returns an ICC transform from the ``inputProfile``213to the ``outputProfile`` using the ``renderingIntent`` to determine what to do214with out-of-gamut colors.  It will ONLY work for converting images that215are in ``inMode`` to images that are in ``outMode`` color format (PIL mode,216i.e. "RGB", "RGBA", "CMYK", etc.).217 218Building the transform is a fair part of the overhead in219ImageCms.profileToProfile(), so if you're planning on converting multiple220images using the same input/output settings, this can save you time.221Once you have a transform object, it can be used with222ImageCms.applyProfile() to convert images without the need to re-compute223the lookup table for the transform.224 225The reason pyCMS returns a class object rather than a handle directly226to the transform is that it needs to keep track of the PIL input/output227modes that the transform is meant for.  These attributes are stored in228the ``inMode`` and ``outMode`` attributes of the object (which can be229manually overridden if you really want to, but I don't know of any230time that would be of use, or would even work).231 232:param inputProfile: String, as a valid filename path to the ICC input233    profile you wish to use for this transform, or a profile object234:param outputProfile: String, as a valid filename path to the ICC output235    profile you wish to use for this transform, or a profile object236:param inMode: String, as a valid PIL mode that the appropriate profile237    also supports (i.e. "RGB", "RGBA", "CMYK", etc.)238:param outMode: String, as a valid PIL mode that the appropriate profile239    also supports (i.e. "RGB", "RGBA", "CMYK", etc.)240:param renderingIntent: Integer (0-3) specifying the rendering intent you241    wish to use for the transform242 243        ImageCms.Intent.PERCEPTUAL            = 0 (DEFAULT)244        ImageCms.Intent.RELATIVE_COLORIMETRIC = 1245        ImageCms.Intent.SATURATION            = 2246        ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3247 248    see the pyCMS documentation for details on rendering intents and what249    they do.250:param flags: Integer (0-...) specifying additional flags251:returns: A CmsTransform class object.252:exception PyCMSError:253rrr�r�r�N�	rsrCr�r�rr�r�r�r�)r�r��inMode�outModer�r�r�r�s        r#r�r��s���~�o�s�+�+�A��4M�A�4M�B����o���e�S�!�!�!�u�*A�	�*A�7�	�{�C����o��	#��,��8�8�*�<�8�L��-��9�9�+�M�:�M� ���/�254�	255��
�Y�256�+�#���m��"��#�s�/A257B:�:C �C�C c258��[U[5(aSUs=::aS::dO Sn[U5e[U[5(aSUs=::a259[::dO S[3n[U5e[U[5(d[	U5n[U[5(d[	U5n[U[5(d[	U5n[UUUUUUUU5$![[[4an	[U	5U	eSn	A	ff=f)a�
260(pyCMS) Builds an ICC transform mapping from the ``inputProfile`` to the261``outputProfile``, but tries to simulate the result that would be262obtained on the ``proofProfile`` device.263 264If the input, output, or proof profiles specified are not valid265filenames, a :exc:`PyCMSError` will be raised.266 267If an error occurs during creation of the transform,268a :exc:`PyCMSError` will be raised.269 270If ``inMode`` or ``outMode`` are not a mode supported by the ``outputProfile``271(or by pyCMS), a :exc:`PyCMSError` will be raised.272 273This function builds and returns an ICC transform from the ``inputProfile``274to the ``outputProfile``, but tries to simulate the result that would be275obtained on the ``proofProfile`` device using ``renderingIntent`` and276``proofRenderingIntent`` to determine what to do with out-of-gamut277colors.  This is known as "soft-proofing".  It will ONLY work for278converting images that are in ``inMode`` to images that are in outMode279color format (PIL mode, i.e. "RGB", "RGBA", "CMYK", etc.).280 281Usage of the resulting transform object is exactly the same as with282ImageCms.buildTransform().283 284Proof profiling is generally used when using an output device to get a285good idea of what the final printed/displayed image would look like on286the ``proofProfile`` device when it's quicker and easier to use the287output device for judging color.  Generally, this means that the288output device is a monitor, or a dye-sub printer (etc.), and the simulated289device is something more expensive, complicated, or time consuming290(making it difficult to make a real print for color judgement purposes).291 292Soft-proofing basically functions by adjusting the colors on the293output device to match the colors of the device being simulated. However,294when the simulated device has a much wider gamut than the output295device, you may obtain marginal results.296 297:param inputProfile: String, as a valid filename path to the ICC input298    profile you wish to use for this transform, or a profile object299:param outputProfile: String, as a valid filename path to the ICC output300    (monitor, usually) profile you wish to use for this transform, or a301    profile object302:param proofProfile: String, as a valid filename path to the ICC proof303    profile you wish to use for this transform, or a profile object304:param inMode: String, as a valid PIL mode that the appropriate profile305    also supports (i.e. "RGB", "RGBA", "CMYK", etc.)306:param outMode: String, as a valid PIL mode that the appropriate profile307    also supports (i.e. "RGB", "RGBA", "CMYK", etc.)308:param renderingIntent: Integer (0-3) specifying the rendering intent you309    wish to use for the input->proof (simulated) transform310 311        ImageCms.Intent.PERCEPTUAL            = 0 (DEFAULT)312        ImageCms.Intent.RELATIVE_COLORIMETRIC = 1313        ImageCms.Intent.SATURATION            = 2314        ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3315 316    see the pyCMS documentation for details on rendering intents and what317    they do.318:param proofRenderingIntent: Integer (0-3) specifying the rendering intent319    you wish to use for proof->output transform320 321        ImageCms.Intent.PERCEPTUAL            = 0 (DEFAULT)322        ImageCms.Intent.RELATIVE_COLORIMETRIC = 1323        ImageCms.Intent.SATURATION            = 2324        ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3325 326    see the pyCMS documentation for details on rendering intents and what327    they do.328:param flags: Integer (0-...) specifying additional flags329:returns: A CmsTransform class object.330:exception PyCMSError:331rrr�r�Nr�)332r�r��proofProfiler�r�r��proofRenderingIntentr�r�r�s333          r#r�r�;s���h�o�s�+�+�A��4M�A�4M�B����o���e�S�!�!�!�u�*A�	�*A�7�	�{�C����o��#��,��8�8�*�<�8�L��-��9�9�+�M�:�M��,��8�8�*�<�8�L� ������� ��	334�		335��
�Y�336�+�#���m��"��#�s�/A1C!�!D�6D�Dc��U(aURU5 SnU$URU5nU$![[4an[	U5UeSnAff=f)aE337(pyCMS) Applies a transform to a given image.338 339If ``im.mode != transform.input_mode``, a :exc:`PyCMSError` is raised.340 341If ``inPlace`` is ``True`` and ``transform.input_mode != transform.output_mode``, a342:exc:`PyCMSError` is raised.343 344If ``im.mode``, ``transform.input_mode`` or ``transform.output_mode`` is not345supported by pyCMSdll or the profiles you used for the transform, a346:exc:`PyCMSError` is raised.347 348If an error occurs while the transform is being applied,349a :exc:`PyCMSError` is raised.350 351This function applies a pre-calculated transform (from352ImageCms.buildTransform() or ImageCms.buildTransformFromOpenProfiles())353to an image. The transform can be used for multiple images, saving354considerable calculation time if doing the same conversion multiple times.355 356If you want to modify im in-place instead of receiving a new image as357the return value, set ``inPlace`` to ``True``.  This can only be done if358``transform.input_mode`` and ``transform.output_mode`` are the same, because we359can't change the mode in-place (the buffer sizes for some modes are360different).  The default behavior is to return a new :py:class:`~PIL.Image.Image`361object of the same dimensions in mode ``transform.output_mode``.362 363:param im: An :py:class:`~PIL.Image.Image` object, and ``im.mode`` must be the same364    as the ``input_mode`` supported by the transform.365:param transform: A valid CmsTransform class object366:param inPlace: Bool.  If ``True``, ``im`` is modified in place and ``None`` is367    returned, if ``False``, a new :py:class:`~PIL.Image.Image` object with the368    transform applied is returned (and ``im`` is not changed). The default is369    ``False``.370:returns: Either ``None``, or a new :py:class:`~PIL.Image.Image` object,371    depending on the value of ``inPlace``. The profile will be returned in372    the image's ``info['icc_profile']``.373:exception PyCMSError:374N)r�r�r�r�r�)r�r�r�r�r�s     r#�applyTransformr��s_��V#���$�$�R�(��E��L�	�O�O�B�'�E��L��
�z�"�#���m��"��#�s�2�2�A�A�Ac��US;aSUS3n[U5eUS:Xa[U5n[R375"X5$![[4anSUS3n[U5UeSnAff=f![[4an[U5UeSnAff=f)a�376(pyCMS) Creates a profile.377 378If colorSpace not in ``["LAB", "XYZ", "sRGB"]``,379a :exc:`PyCMSError` is raised.380 381If using LAB and ``colorTemp`` is not a positive integer,382a :exc:`PyCMSError` is raised.383 384If an error occurs while creating the profile,385a :exc:`PyCMSError` is raised.386 387Use this function to create common profiles on-the-fly instead of388having to supply a profile on disk and knowing the path to it.  It389returns a normal CmsProfile object that can be passed to390ImageCms.buildTransformFromOpenProfiles() to create a transform to apply391to images.392 393:param colorSpace: String, the color space of the profile you wish to394    create.395    Currently only "LAB", "XYZ", and "sRGB" are supported.396:param colorTemp: Positive number for the white point for the profile, in397    degrees Kelvin (i.e. 5000, 6500, 9600, etc.).  The default is for D50398    illuminant if omitted (5000k).  colorTemp is ONLY applied to LAB399    profiles, and is ignored for XYZ and sRGB.400:returns: A CmsProfile class object401:exception PyCMSError:402)�LAB�XYZ�sRGBz;Color space not supported for on-the-fly profile creation (�)r�z$Color temperature must be numeric, "z" not validN)r��floatr�r�r{�
createProfile)�403colorSpace�	colorTempr��er�s     r#r�r��s���@�/�/�I�*��UV�W�	���o���U��	)��i�(�I�404#��!�!�*�8�8���:�&�	)�8���;�O�C��S�/�q�(��	)��
�z�"�#���m��"��#�s.�A�A+�A(�A#�#A(�+B�;B�Bc��[U[5(d[U5nURRnURRnU(d)U(d"URR405=(d SS-$U(aU(a[
U5S:�aUS3$USUS3$![[[[4an[U5UeSnAff=f)a�406 407(pyCMS) Gets the internal product name for the given profile.408 409If ``profile`` isn't a valid CmsProfile object or filename to a profile,410a :exc:`PyCMSError` is raised If an error occurs while trying411to obtain the name tag, a :exc:`PyCMSError` is raised.412 413Use this function to obtain the INTERNAL name of the profile (stored414in an ICC tag in the profile itself), usually the one used when the415profile was originally created.  Sometimes this tag also contains416additional information supplied by the creator.417 418:param profile: EITHER a valid CmsProfile object, OR a string of the419    filename of an ICC profile.420:returns: A string containing the internal name of the profile as stored421    in an ICC tag.422:exception PyCMSError:423r��424�z - N)rsrr}�model�manufacturer�profile_description�lenr�r�r�r�r�)r}r�r�r�s    r#�getProfileNamer�s���*#��'�?�3�3�%�g�.�G�425���%�%�����3�3�����O�O�7�7�=�2��E�E���#�e�*�r�/��W�B�<�����L�>��,�,���G�Y�426�;�#���m��"��#�s$�A;B(�>!B(� B(�(C�C�Cc�`�[U[5(d[U5nURRnURRnX4Vs/sH
o3(dMUPM nnSRU5S-$s snf![[[[4an[U5UeSnAff=f)a�427(pyCMS) Gets the internal product information for the given profile.428 429If ``profile`` isn't a valid CmsProfile object or filename to a profile,430a :exc:`PyCMSError` is raised.431 432If an error occurs while trying to obtain the info tag,433a :exc:`PyCMSError` is raised.434 435Use this function to obtain the information stored in the profile's436info tag.  This often contains details about the profile, and how it437was created, as supplied by the creator.438 439:param profile: EITHER a valid CmsProfile object, OR a string of the440    filename of an ICC profile.441:returns: A string containing the internal profile information stored in442    an ICC tag.443:exception PyCMSError:444z
445
446N)rsrr}r��	copyright�joinr�r�r�r�r�)r}�description�cpright�element�elementsr�s      r#�getProfileInfor�Ds���*
#��'�?�3�3�%�g�.�G�447�o�o�9�9���/�/�+�+��,7�+A�M�+A��W�G�+A��M����x�(�:�5�5��N��
�G�Y�448�;�#���m��"��#�s0�AB�449A=�!A=�'B�=B�B-�B(�(B-c���[U[5(d[U5nURR=(d SS-$![[450[[4an[U5UeSnAff=f)a#451(pyCMS) Gets the copyright for the given profile.452 453If ``profile`` isn't a valid CmsProfile object or filename to a profile, a454:exc:`PyCMSError` is raised.455 456If an error occurs while trying to obtain the copyright tag,457a :exc:`PyCMSError` is raised.458 459Use this function to obtain the information stored in the profile's460copyright tag.461 462:param profile: EITHER a valid CmsProfile object, OR a string of the463    filename of an ICC profile.464:returns: A string containing the internal profile information stored in465    an ICC tag.466:exception PyCMSError:467r�r�N)	rsrr}r�r�r�r�r�r��r}r�s  r#�getProfileCopyrightr�is]��&#��'�?�3�3�%�g�.�G����)�)�/�R�4�7�7���G�Y�468�;�#���m��"��#���AA�A/�A*�*A/c���[U[5(d[U5nURR=(d SS-$![[469[[4an[U5UeSnAff=f)a,470(pyCMS) Gets the manufacturer for the given profile.471 472If ``profile`` isn't a valid CmsProfile object or filename to a profile, a473:exc:`PyCMSError` is raised.474 475If an error occurs while trying to obtain the manufacturer tag, a476:exc:`PyCMSError` is raised.477 478Use this function to obtain the information stored in the profile's479manufacturer tag.480 481:param profile: EITHER a valid CmsProfile object, OR a string of the482    filename of an ICC profile.483:returns: A string containing the internal profile information stored in484    an ICC tag.485:exception PyCMSError:486r�r�N)	rsrr}r�r�r�r�r�r�r�s  r#�getProfileManufacturerr�s]��&#��'�?�3�3�%�g�.�G����,�,�2��d�:�:���G�Y�487�;�#���m��"��#�r�c���[U[5(d[U5nURR=(d SS-$![[488[[4an[U5UeSnAff=f)a489(pyCMS) Gets the model for the given profile.490 491If ``profile`` isn't a valid CmsProfile object or filename to a profile, a492:exc:`PyCMSError` is raised.493 494If an error occurs while trying to obtain the model tag,495a :exc:`PyCMSError` is raised.496 497Use this function to obtain the information stored in the profile's498model tag.499 500:param profile: EITHER a valid CmsProfile object, OR a string of the501    filename of an ICC profile.502:returns: A string containing the internal profile information stored in503    an ICC tag.504:exception PyCMSError:505r�r�N)	rsrr}r�r�r�r�r�r�r�s  r#�getProfileModelr�s]��(#��'�?�3�3�%�g�.�G����%�%�+��t�3�3���G�Y�506�;�#���m��"��#�r�c���[U[5(d[U5nURR=(d SS-$![[507[[4an[U5UeSnAff=f)a)508(pyCMS) Gets the description for the given profile.509 510If ``profile`` isn't a valid CmsProfile object or filename to a profile, a511:exc:`PyCMSError` is raised.512 513If an error occurs while trying to obtain the description tag,514a :exc:`PyCMSError` is raised.515 516Use this function to obtain the information stored in the profile's517description tag.518 519:param profile: EITHER a valid CmsProfile object, OR a string of the520    filename of an ICC profile.521:returns: A string containing the internal profile information stored in an522    ICC tag.523:exception PyCMSError:524r�r�N)	rsrr}r�r�r�r�r�r�r�s  r#�getProfileDescriptionr�s]��(#��'�?�3�3�%�g�.�G����3�3�9�r�T�A�A���G�Y�525�;�#���m��"��#�r�c���[U[5(d[U5nURR$![[526[[4an[U5UeSnAff=f)aK527(pyCMS) Gets the default intent name for the given profile.528 529If ``profile`` isn't a valid CmsProfile object or filename to a profile, a530:exc:`PyCMSError` is raised.531 532If an error occurs while trying to obtain the default intent, a533:exc:`PyCMSError` is raised.534 535Use this function to determine the default (and usually best optimized)536rendering intent for this profile.  Most profiles support multiple537rendering intents, but are intended mostly for one type of conversion.538If you wish to use a different intent than returned, use539ImageCms.isIntentSupported() to verify it will work first.540 541:param profile: EITHER a valid CmsProfile object, OR a string of the542    filename of an ICC profile.543:returns: Integer 0-3 specifying the default rendering intent for this544    profile.545 546        ImageCms.Intent.PERCEPTUAL            = 0 (DEFAULT)547        ImageCms.Intent.RELATIVE_COLORIMETRIC = 1548        ImageCms.Intent.SATURATION            = 2549        ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3550 551    see the pyCMS documentation for details on rendering intents and what552        they do.553:exception PyCMSError:554N)	rsrr}�rendering_intentr�r�r�r�r�r�s  r#�getDefaultIntentr�sS��>#��'�?�3�3�%�g�.�G����/�/�/���G�Y�555�;�#���m��"��#�s�58�A#�A�A#c���[U[5(d[U5nURRX5(agg![[556[[4an[U5UeSnAff=f)a�557(pyCMS) Checks if a given intent is supported.558 559Use this function to verify that you can use your desired560``intent`` with ``profile``, and that ``profile`` can be used for the561input/output/proof profile as you desire.562 563Some profiles are created specifically for one "direction", can cannot564be used for others. Some profiles can only be used for certain565rendering intents, so it's best to either verify this before trying566to create a transform with them (using this function), or catch the567potential :exc:`PyCMSError` that will occur if they don't568support the modes you select.569 570:param profile: EITHER a valid CmsProfile object, OR a string of the571    filename of an ICC profile.572:param intent: Integer (0-3) specifying the rendering intent you wish to573    use with this profile574 575        ImageCms.Intent.PERCEPTUAL            = 0 (DEFAULT)576        ImageCms.Intent.RELATIVE_COLORIMETRIC = 1577        ImageCms.Intent.SATURATION            = 2578        ImageCms.Intent.ABSOLUTE_COLORIMETRIC = 3579 580    see the pyCMS documentation for details on rendering intents and what581        they do.582:param direction: Integer specifying if the profile is to be used for583    input, output, or proof584 585        INPUT  = 0 (or use ImageCms.Direction.INPUT)586        OUTPUT = 1 (or use ImageCms.Direction.OUTPUT)587        PROOF  = 2 (or use ImageCms.Direction.PROOF)588 589:returns: 1 if the intent/direction are supported, -1 if they are not.590:exception PyCMSError:591r�����N)	rsrr}�is_intent_supportedr�r�r�r�r�)r}r��	directionr�s    r#�isIntentSupportedr
sa��P592#��'�?�3�3�%�g�.�G��?�?�.�.�v�A�A�����G�Y�593�;�#���m��"��#�s�AA�A/�A*�*A/r�)r�zSupportsInt | NonerDr�)r�r�r��_CmsProfileCompatibler�rr�rr�z594str | Noner��boolr�r+rDr�)r�r�rDr)r�rr�rr�rtr�rtr�rr�r+rDr�)r�rr�rr�rr�rtr�rtr�rr�rr�r+rDr�)F)r�r�r�r�r�rrDr�)r)r�zLiteral['LAB', 'XYZ', 'sRGB']r�r	rDzcore.CmsProfile)r}rrDrt)r}rrDrC)r}rr�rrr%rDzLiteral[-1, 1])B�595__future__r�operatorru�enumrr�	functoolsr�typingrrr	r596rr�r
�597_deprecater�_typingrrr{rtr�r�r�ImportError�ex�_utilrr��_DESCRIPTION�_VERSIONrr%r+�or_r��_FLAGSr�ImagePointHandlerr�r��	Exceptionr�rr>r�r�r�r rJr��buildTransformFromOpenProfiles�#buildProofTransformFromOpenProfilesr�r�r�r�r�rrrrr
rr"r#�<module>r"s���(#��598�!��B�B��!�!�!�%�!��\�%�
 �$�/�/�3D�D���=��~���W�����8/�G�8/�v
�8�<�<��'�	�599��1�600��A�601��5�602��1�	603��"�604���605���606��#�607��S�608��d�609��T�610��d�611��d�612� �$�!613�"�E�#614�$�U�%615�&�H�'616�(�,�)617��@,2�,2�^8��/�/�8�v$�4	��	�%�/�/�!���:�:�]��]�'�]�)�]��	]�618�]��
]��]��]�@#�@�#��#�:%�/�/��:�:�
P#�'�P#�(�P#�
�P#��	P#�619�P#��
P#��P#�r%�/�/�#)�#?�#?��%�%�n#�'�n#�(�n#�(�n#�
�	n#�620�n#��
n#�!�n#��n#��n#�b"0��&9�#�DI�4��4� 1�4�<@�4��4�pKL�0#�-�0#�:G�0#��0#�f'#�T"#�J#�8#�8#�:#�:$#�N2#�
"�2#�,2�2#�?H�2#��2#��y�!�%����R� �D��!�s�G(�(H�.H�H
codekingpro/portable-devtools · Team Ai