zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
U
T±dt—ã@sàddlZddlmZddlmZddlmZzddlmZWn6ek
rrZ    zddl
m Z e e    ƒZW5dZ    [    XYnXdZ d    Z eZGd
d „d eƒZGd d „d eƒZdd„Zddddddddddddddddddd „d!œZdZe ¡D]ZeeeƒrâeeBZqâGd"d#„d#ƒZGd$d%„d%ejƒZdKd&d'„ZGd(d)„d)eƒZejdd*dfd+d,„Zd-d.„Z ejdfd/d0„Z!ejej"ed1fd2d3„Z#e!Z$e#Z%dLd4d5„Z&dMd7d8„Z'd9d:„Z(d;d<„Z)d=d>„Z*d?d@„Z+dAdB„Z,dCdD„Z-dEdF„Z.dGdH„Z/dIdJ„Z0dS)NéN)ÚIntEnum)ÚImageé)Ú    deprecate)Ú _imagingcms)Ú DeferredErrora|    
pyCMS
 
    a Python / PIL interface to the littleCMS ICC Color Management System
    Copyright (C) 2002-2003 Kevin Cazabon
    kevin@cazabon.com
    https://www.cazabon.com
 
    pyCMS home page:  https://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 pilc@seZdZdZdZdZdZdS)ÚIntentrrééN)Ú__name__Ú
__module__Ú __qualname__Ú
PERCEPTUALZRELATIVE_COLORIMETRICZ
SATURATIONÚABSOLUTE_COLORIMETRIC©rrúCd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\PIL/ImageCms.pyrksrc@seZdZdZdZdZdS)Ú    Directionrrr    N)r r r ZINPUTZOUTPUTZPROOFrrrrrrsrcCsˆtdtdi ¡D]X\}}| |¡r|t|ƒd…}||jkrt|›|›d|j›d|›ƒ||Sqdt›d|›d}t|ƒ‚dS)NZINTENT_Z
DIRECTION_é
Ú.zmodule 'z' has no attribute 'ú')    rrÚitemsÚ
startswithÚlenÚ __members__rr ÚAttributeError)ÚnameÚenumÚprefixÚmsgrrrÚ __getattr__xs
 
 rr    r
ééé é@éiiii ii@i€icCs |d@d>S)Néÿr!r)ÚnrrrÚ<lambda>šór')Z MATRIXINPUTZ MATRIXOUTPUTZ
MATRIXONLYZNOWHITEONWHITEFIXUPZNOPRELINEARIZATIONZGUESSDEVICECLASSZNOTCACHEZ
NOTPRECALCZ NULLTRANSFORMZHIGHRESPRECALCZ LOWRESPRECALCZWHITEBLACKCOMPENSATIONZBLACKPOINTCOMPENSATIONZ
GAMUTCHECKÚ SOFTPROOFINGZ PRESERVEBLACKZNODEFAULTRESOURCEDEFZ
GRIDPOINTSc@s&eZdZdd„Zddd„Zdd„ZdS)    ÚImageCmsProfilec CsÈt|tƒr€tjdkrl| ¡}z| d¡Wn@tk
rjt|dƒ}| t     
|  ¡¡¡W5QRXYdSX| t      |¡|¡nDt |dƒr | t     
|  ¡¡¡n$t|tjƒr¸| |¡n d}t|ƒ‚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_frombytesr.Z profile_openÚhasattrrZ
CmsProfileÚ    TypeError)ÚselfÚprofileZprofile_bytes_pathÚfrrrrÚ__init__¬s 
 
 
  zImageCmsProfile.__init__NcCs.||_||_|rd|_d|_n d|_d|_dS©N)r<ÚfilenameZ product_nameZ product_info)r;r<r@rrrr7ÆszImageCmsProfile._setcCs t |j¡S)zŸ
        Returns the profile in a format suitable for embedding in
        saved images.
 
        :returns: a bytes object containing the ICC profile.
        )r8Zprofile_tobytesr<)r;rrrÚtobytesÐszImageCmsProfile.tobytes)N)r r r r>r7rArrrrr*«s
 
r*c@s@eZdZdZejdejdfdd„Zdd„Zd dd    „Z    d
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$t |j|j||||¡|_n t |j|j|j|||||¡|_||_|_||_|_||_    dSr?)
r8ÚbuildTransformr<Ú    transformÚbuildProofTransformÚ
input_modeZ    inputModeÚ output_modeÚ
outputModeÚoutput_profile)    r;ÚinputÚoutputrFrGÚintentZproofZ proof_intentÚflagsrrrr>äs, ÿø  zImageCmsTransform.__init__cCs
| |¡Sr?)Úapply)r;ÚimrrrÚpointszImageCmsTransform.pointcCsL| ¡|dkr"t |j|jd¡}|j |jj|jj¡|j     
¡|j d<|S)NÚ icc_profile) ÚloadrÚnewrGÚsizerDrNrOÚidrIrAÚinfo)r;rOÚimOutrrrrNs zImageCmsTransform.applycCsJ| ¡|j|jkr d}t|ƒ‚|j |jj|jj¡|j     ¡|j
d<|S)Nz mode mismatchrQ) rRÚmoderGÚ
ValueErrorrDrNrOrUrIrArV)r;rOrrrrÚapply_in_places z ImageCmsTransform.apply_in_place)N) r r r Ú__doc__rrrr>rPrNrZrrrrrBÛs ÷
 
rBcCsVtjdkrdSddlm}t||jƒr4t |d¡}nt |p>d¡}|dkrNdSt|ƒS)z
    (experimental) Fetches the profile for the current display device.
 
    :returns: ``None`` if the profile is not known.
    r+Nr)ÚImageWinr)    r1r2ÚPILr\r/ÚHDCr8Zget_display_profile_win32r*)Úhandler\r<rrrÚget_display_profiles
  r`c@seZdZdZdS)Ú
PyCMSErrorzJ(pyCMS) Exception class.
    This is used for all errors in the pyCMS API.N)r r r r[rrrrra3sraFc
Cs|dkr|j}t|tƒr.d|kr,dks:nd}t|ƒ‚t|tƒrZd|krXtkslndt›}t|ƒ‚z\t|tƒs€t|ƒ}t|tƒs’t|ƒ}t|||j|||d}|r¼| |¡d}    n
| |¡}    Wn2t    t
t fk
rú}
zt|
ƒ|
‚W5d}
~
XYnX|    S)a
 
    (pyCMS) Applies an ICC transformation to a given image, mapping from
    ``inputProfile`` to ``outputProfile``.
 
    If the input or output profiles specified are not valid filenames, a
    :exc:`PyCMSError` will be raised.  If ``inPlace`` is ``True`` and
    ``outputMode != im.mode``, a :exc:`PyCMSError` will be raised.
    If an error occurs during application of the profiles,
    a :exc:`PyCMSError` will be raised.
    If ``outputMode`` is not a mode supported by the ``outputProfile`` (or by pyCMS),
    a :exc:`PyCMSError` will be raised.
 
    This function applies an ICC transformation to im from ``inputProfile``'s
    color space to ``outputProfile``'s color space using the specified rendering
    intent to decide how to handle out-of-gamut colors.
 
    ``outputMode`` can be used to specify that a color mode conversion is to
    be done using these profiles, but the specified profiles must be able
    to handle that mode.  I.e., if converting im from RGB to CMYK using
    profiles, the input profile must handle RGB data, and the output
    profile must handle CMYK data.
 
    :param im: An open :py:class:`~PIL.Image.Image` object (i.e. Image.new(...)
        or Image.open(...), etc.)
    :param inputProfile: String, as a valid filename path to the ICC input
        profile you wish to use for this image, or a profile object
    :param outputProfile: String, as a valid filename path to the ICC output
        profile you wish to use for this image, or a profile object
    :param renderingIntent: Integer (0-3) specifying the rendering intent you
        wish to use for the 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 outputMode: A valid PIL mode for the output image (i.e. "RGB",
        "CMYK", etc.).  Note: if rendering the image "inPlace", outputMode
        MUST be the same mode as the input, or omitted completely.  If
        omitted, the outputMode will be the same as the mode of the input
        image (im.mode)
    :param inPlace: Boolean.  If ``True``, the original image is modified in-place,
        and ``None`` is returned.  If ``False`` (default), a new
        :py:class:`~PIL.Image.Image` object is returned with the transform applied.
    :param flags: Integer (0-...) specifying additional flags
    :returns: Either None or a new :py:class:`~PIL.Image.Image` object, depending on
        the value of ``inPlace``
    :exception PyCMSError:
    Nrr
ú2renderingIntent must be an integer between 0 and 3z'flags must be an integer between 0 and ©rM) rXr/ÚintraÚ    _MAX_FLAGr*rBrZrNÚOSErrorr:rY) rOÚ inputProfileÚ outputProfileÚrenderingIntentrHÚinPlacerMrrDrWÚvrrrÚprofileToProfile;s8=  
 
 
ú
rlc
CsBz
t|ƒWStttfk
r<}zt|ƒ|‚W5d}~XYnXdS)aü
    (pyCMS) Opens an ICC profile file.
 
    The PyCMSProfile object can be passed back into pyCMS for use in creating
    transforms and such (as in ImageCms.buildTransformFromOpenProfiles()).
 
    If ``profileFilename`` is not a valid filename for an ICC profile,
    a :exc:`PyCMSError` will be raised.
 
    :param profileFilename: String, as a valid filename path to the ICC profile
        you wish to open, or a file-like object.
    :returns: A CmsProfile class object.
    :exception PyCMSError:
    N)r*rfr:rYra)ZprofileFilenamerkrrrÚgetOpenProfile›s
rmc
CsÎt|tƒr d|krdks,nd}t|ƒ‚t|tƒrLd|krJtks\ndt}t|ƒ‚z:t|tƒspt|ƒ}t|tƒs‚t|ƒ}t||||||dWStttfk
rÈ}zt|ƒ|‚W5d}~XYnXdS)a
    (pyCMS) Builds an ICC transform mapping from the ``inputProfile`` to the
    ``outputProfile``. Use applyTransform to apply the transform to a given
    image.
 
    If the input or output profiles specified are not valid filenames, a
    :exc:`PyCMSError` will be raised. If an error occurs during creation
    of the transform, a :exc:`PyCMSError` will be raised.
 
    If ``inMode`` or ``outMode`` are not a mode supported by the ``outputProfile``
    (or by pyCMS), a :exc:`PyCMSError` will be raised.
 
    This function builds and returns an ICC transform from the ``inputProfile``
    to the ``outputProfile`` using the ``renderingIntent`` to determine what to do
    with out-of-gamut colors.  It will ONLY work for converting images that
    are in ``inMode`` to images that are in ``outMode`` color format (PIL mode,
    i.e. "RGB", "RGBA", "CMYK", etc.).
 
    Building the transform is a fair part of the overhead in
    ImageCms.profileToProfile(), so if you're planning on converting multiple
    images using the same input/output settings, this can save you time.
    Once you have a transform object, it can be used with
    ImageCms.applyProfile() to convert images without the need to re-compute
    the lookup table for the transform.
 
    The reason pyCMS returns a class object rather than a handle directly
    to the transform is that it needs to keep track of the PIL input/output
    modes that the transform is meant for.  These attributes are stored in
    the ``inMode`` and ``outMode`` attributes of the object (which can be
    manually overridden if you really want to, but I don't know of any
    time that would be of use, or would even work).
 
    :param inputProfile: String, as a valid filename path to the ICC input
        profile you wish to use for this transform, or a profile object
    :param outputProfile: String, as a valid filename path to the ICC output
        profile you wish to use for this transform, or a profile object
    :param inMode: String, as a valid PIL mode that the appropriate profile
        also supports (i.e. "RGB", "RGBA", "CMYK", etc.)
    :param outMode: String, as a valid PIL mode that the appropriate profile
        also supports (i.e. "RGB", "RGBA", "CMYK", etc.)
    :param renderingIntent: Integer (0-3) specifying the rendering intent you
        wish to use for the 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:
    rr
rbú)flags must be an integer between 0 and %srcN©    r/rdrarer*rBrfr:rY)rgrhÚinModeÚoutModerirMrrkrrrrC±s*?  
 
ÿrCr)c
 
Csât|tƒr d|krdks,nd}t|ƒ‚t|tƒrLd|krJtks\ndt}t|ƒ‚zNt|tƒspt|ƒ}t|tƒs‚t|ƒ}t|tƒs”t|ƒ}t||||||||ƒWStttfk
rÜ}    zt|    ƒ|    ‚W5d}    ~    XYnXdS)aš
    (pyCMS) Builds an ICC transform mapping from the ``inputProfile`` to the
    ``outputProfile``, but tries to simulate the result that would be
    obtained on the ``proofProfile`` device.
 
    If the input, output, or proof profiles specified are not valid
    filenames, a :exc:`PyCMSError` will be raised.
 
    If an error occurs during creation of the transform,
    a :exc:`PyCMSError` will be raised.
 
    If ``inMode`` or ``outMode`` are not a mode supported by the ``outputProfile``
    (or by pyCMS), a :exc:`PyCMSError` will be raised.
 
    This function builds and returns an ICC transform from the ``inputProfile``
    to the ``outputProfile``, but tries to simulate the result that would be
    obtained on the ``proofProfile`` device using ``renderingIntent`` and
    ``proofRenderingIntent`` to determine what to do with out-of-gamut
    colors.  This is known as "soft-proofing".  It will ONLY work for
    converting images that are in ``inMode`` to images that are in outMode
    color format (PIL mode, i.e. "RGB", "RGBA", "CMYK", etc.).
 
    Usage of the resulting transform object is exactly the same as with
    ImageCms.buildTransform().
 
    Proof profiling is generally used when using an output device to get a
    good idea of what the final printed/displayed image would look like on
    the ``proofProfile`` device when it's quicker and easier to use the
    output device for judging color.  Generally, this means that the
    output device is a monitor, or a dye-sub printer (etc.), and the simulated
    device is something more expensive, complicated, or time consuming
    (making it difficult to make a real print for color judgement purposes).
 
    Soft-proofing basically functions by adjusting the colors on the
    output device to match the colors of the device being simulated. However,
    when the simulated device has a much wider gamut than the output
    device, you may obtain marginal results.
 
    :param inputProfile: String, as a valid filename path to the ICC input
        profile you wish to use for this transform, or a profile object
    :param outputProfile: String, as a valid filename path to the ICC output
        (monitor, usually) profile you wish to use for this transform, or a
        profile object
    :param proofProfile: String, as a valid filename path to the ICC proof
        profile you wish to use for this transform, or a profile object
    :param inMode: String, as a valid PIL mode that the appropriate profile
        also supports (i.e. "RGB", "RGBA", "CMYK", etc.)
    :param outMode: String, as a valid PIL mode that the appropriate profile
        also supports (i.e. "RGB", "RGBA", "CMYK", etc.)
    :param renderingIntent: Integer (0-3) specifying the rendering intent you
        wish to use for the input->proof (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:
    rr
rbrnNro)
rgrhZ proofProfilerprqriZproofRenderingIntentrMrrkrrrrEs2T  
 
 
ø
rEc
CsXz"|r| |¡d}n
| |¡}Wn0ttfk
rR}zt|ƒ|‚W5d}~XYnX|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)rZrNr:rYra)rOrDrjrWrkrrrÚapplyTransformys)
rréÿÿÿÿc
Cs²|dkrd|›d}t|ƒ‚|dkrnz t|ƒ}Wn<ttfk
rl}zd|›d}t|ƒ|‚W5d}~XYnXzt ||¡WSttfk
r¬}zt|ƒ|‚W5d}~XYnXdS)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:
    )ÚLABZXYZZsRGBz;Color space not supported for on-the-fly profile creation (ú)rtz$Color temperature must be numeric, "z " not validN)raÚfloatr:rYr8Ú createProfile)Z
colorSpaceZ    colorTemprÚerkrrrrw®s
ÿ  rwc Cs¢zht|tƒst|ƒ}|jj}|jj}|s>|s>|jjp6ddWS|rNt|ƒdkrX|dWS|›d|›dWSttt    t
fk
rœ}zt |ƒ|‚W5d}~XYnXdS)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) r/r*r<ÚmodelÚ manufacturerÚprofile_descriptionrrrfr:rYra)r<r|r}rkrrrÚgetProfileNameßs
 
rc CsŒzRt|tƒst|ƒ}|jj}|jj}g}||fD]}|r0| |¡q0d |¡dWSttt    t
fk
r†}zt |ƒ|‚W5d}~XYnXdS)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) r/r*r<r~Ú    copyrightÚappendÚjoinrrfr:rYra)r<Ú descriptionZcprightZarrÚeltrkrrrÚgetProfileInfo    s
  r…c Cs^z$t|tƒst|ƒ}|jjpddWSttttfk
rX}zt|ƒ|‚W5d}~XYnXdS)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:
    ryrzN)    r/r*r<r€rrfr:rYra©r<rkrrrÚgetProfileCopyright1s 
r‡c Cs^z$t|tƒst|ƒ}|jjpddWSttttfk
rX}zt|ƒ|‚W5d}~XYnXdS)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:
    ryrzN)    r/r*r<r}rrfr:rYrar†rrrÚgetProfileManufacturerMs 
rˆc Cs^z$t|tƒst|ƒ}|jjpddWSttttfk
rX}zt|ƒ|‚W5d}~XYnXdS)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:
    ryrzN)    r/r*r<r|rrfr:rYrar†rrrÚgetProfileModelis 
r‰c Cs^z$t|tƒst|ƒ}|jjpddWSttttfk
rX}zt|ƒ|‚W5d}~XYnXdS)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:
    ryrzN)    r/r*r<r~rrfr:rYrar†rrrÚgetProfileDescription†s 
rŠc CsVzt|tƒst|ƒ}|jjWSttttfk
rP}zt|ƒ|‚W5d}~XYnXdS)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)    r/r*r<Zrendering_intentrrfr:rYrar†rrrÚgetDefaultIntent£s 
 
r‹c Csjz0t|tƒst|ƒ}|j ||¡r(WdSWdSWn4ttttfk
rd}zt|ƒ|‚W5d}~XYnXdS)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:
    rrsN)    r/r*r<Zis_intent_supportedrrfr:rYra)r<rLÚ    directionrkrrrÚisIntentSupportedÊs&
 
rcCsttjtj ¡dtjfS)z#
    (pyCMS) Fetches versions.
    r)ÚVERSIONr8Zlittlecms_versionr1ÚversionÚsplitrÚ __version__rrrrÚversionsýsr’)N)F)rs)1r1rrr]rZ
_deprecaterrÚ ImportErrorÚexZ_utilrZ DESCRIPTIONrŽr8rrrÚFLAGSreÚvaluesÚflagr/rdr*ZImagePointHandlerrBr`Ú    ExceptionrarrlrmrCrrEZbuildTransformFromOpenProfilesZ#buildProofTransformFromOpenProfilesrrrwrr…r‡rˆr‰rŠr‹rr’rrrrÚ<module>s†    ?ì 
 
0>
 ù
`ú
Yø
q
5
1*('3