python-lcms2 0.1.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. python_lcms2-0.2.2/MANIFEST.in +9 -0
  2. python_lcms2-0.2.2/PKG-INFO +190 -0
  3. python_lcms2-0.2.2/README.md +141 -0
  4. python_lcms2-0.2.2/lcms2/__init__.py +76 -0
  5. python_lcms2-0.2.2/lcms2/__init__.pyi +76 -0
  6. python_lcms2-0.2.2/lcms2/_builtins.py +150 -0
  7. python_lcms2-0.2.2/lcms2/_builtins.pyi +18 -0
  8. python_lcms2-0.2.2/lcms2/_constants.py +209 -0
  9. python_lcms2-0.2.2/lcms2/_constants.pyi +80 -0
  10. python_lcms2-0.2.2/lcms2/_convert.py +185 -0
  11. python_lcms2-0.2.2/lcms2/_convert.pyi +15 -0
  12. python_lcms2-0.2.2/lcms2/_curves.py +338 -0
  13. python_lcms2-0.2.2/lcms2/_curves.pyi +40 -0
  14. python_lcms2-0.2.2/lcms2/_data/__init__.py +54 -0
  15. python_lcms2-0.2.2/lcms2/_data/__init__.pyi +6 -0
  16. python_lcms2-0.2.2/lcms2/_data/illuminants.csv +53 -0
  17. python_lcms2-0.2.2/lcms2/_data/rgb_spaces.csv +21 -0
  18. python_lcms2-0.2.2/lcms2/_errors.py +20 -0
  19. python_lcms2-0.2.2/lcms2/_errors.pyi +12 -0
  20. python_lcms2-0.2.2/lcms2/_ext/cgats.c +348 -0
  21. python_lcms2-0.2.2/lcms2/_ext/colorimetry.c +338 -0
  22. python_lcms2-0.2.2/lcms2/_ext/common.h +70 -0
  23. python_lcms2-0.2.2/lcms2/_ext/curves.c +320 -0
  24. python_lcms2-0.2.2/lcms2/_ext/errors.c +123 -0
  25. python_lcms2-0.2.2/lcms2/_ext/formats.c +121 -0
  26. python_lcms2-0.2.2/lcms2/_ext/formats_table.h +196 -0
  27. python_lcms2-0.2.2/lcms2/_ext/module.c +71 -0
  28. python_lcms2-0.2.2/lcms2/_ext/profile.c +476 -0
  29. python_lcms2-0.2.2/lcms2/_ext/profile.h +35 -0
  30. python_lcms2-0.2.2/lcms2/_ext/profile_info.c +331 -0
  31. python_lcms2-0.2.2/lcms2/_ext/profile_tags.c +330 -0
  32. python_lcms2-0.2.2/lcms2/_ext/transform.c +430 -0
  33. python_lcms2-0.2.2/lcms2/_formats.py +133 -0
  34. python_lcms2-0.2.2/lcms2/_formats.pyi +20 -0
  35. python_lcms2-0.2.2/lcms2/_lcms2.pyi +274 -0
  36. python_lcms2-0.2.2/lcms2/_parallel.py +99 -0
  37. python_lcms2-0.2.2/lcms2/_parallel.pyi +11 -0
  38. python_lcms2-0.2.2/lcms2/_parse.py +227 -0
  39. python_lcms2-0.2.2/lcms2/_parse.pyi +10 -0
  40. python_lcms2-0.2.2/lcms2/_profile.py +448 -0
  41. python_lcms2-0.2.2/lcms2/_profile.pyi +125 -0
  42. python_lcms2-0.2.2/lcms2/_profile_data.py +148 -0
  43. python_lcms2-0.2.2/lcms2/_profile_data.pyi +38 -0
  44. python_lcms2-0.2.2/lcms2/_transform.py +406 -0
  45. python_lcms2-0.2.2/lcms2/_transform.pyi +53 -0
  46. python_lcms2-0.2.2/lcms2/cgats.py +335 -0
  47. python_lcms2-0.2.2/lcms2/cgats.pyi +56 -0
  48. python_lcms2-0.2.2/lcms2/colorimetry/__init__.py +41 -0
  49. python_lcms2-0.2.2/lcms2/colorimetry/__init__.pyi +36 -0
  50. python_lcms2-0.2.2/lcms2/colorimetry/_ciecam02.py +111 -0
  51. python_lcms2-0.2.2/lcms2/colorimetry/_ciecam02.pyi +24 -0
  52. python_lcms2-0.2.2/lcms2/colorimetry/_convert.py +197 -0
  53. python_lcms2-0.2.2/lcms2/colorimetry/_convert.pyi +38 -0
  54. python_lcms2-0.2.2/lcms2/colorimetry/_core.py +34 -0
  55. python_lcms2-0.2.2/lcms2/colorimetry/_core.pyi +8 -0
  56. python_lcms2-0.2.2/lcms2/colorimetry/_delta_e.py +79 -0
  57. python_lcms2-0.2.2/lcms2/colorimetry/_delta_e.pyi +11 -0
  58. python_lcms2-0.2.2/lcms2/colorimetry/_whites.py +66 -0
  59. python_lcms2-0.2.2/lcms2/colorimetry/_whites.pyi +8 -0
  60. python_lcms2-0.2.2/lcms2/colormap/__init__.py +23 -0
  61. python_lcms2-0.2.2/lcms2/colormap/__init__.pyi +4 -0
  62. python_lcms2-0.2.2/lcms2/colormap/_build.py +135 -0
  63. python_lcms2-0.2.2/lcms2/colormap/_build.pyi +23 -0
  64. python_lcms2-0.2.2/lcms2/colormap/_builtin.py +46 -0
  65. python_lcms2-0.2.2/lcms2/colormap/_builtin.pyi +5 -0
  66. python_lcms2-0.2.2/lcms2/colormap/_colormap.py +319 -0
  67. python_lcms2-0.2.2/lcms2/colormap/_colormap.pyi +53 -0
  68. python_lcms2-0.2.2/lcms2/colormap/_cvd_data.py +163 -0
  69. python_lcms2-0.2.2/lcms2/colormap/_cvd_data.pyi +1 -0
  70. python_lcms2-0.2.2/lcms2/colormap/_diagnostics.py +144 -0
  71. python_lcms2-0.2.2/lcms2/colormap/_diagnostics.pyi +11 -0
  72. python_lcms2-0.2.2/lcms2/colormap/_export.py +227 -0
  73. python_lcms2-0.2.2/lcms2/colormap/_export.pyi +22 -0
  74. python_lcms2-0.2.2/lcms2/colormap/_generators.py +212 -0
  75. python_lcms2-0.2.2/lcms2/colormap/_generators.pyi +45 -0
  76. python_lcms2-0.2.2/lcms2/icc/__init__.py +24 -0
  77. python_lcms2-0.2.2/lcms2/icc/__init__.pyi +14 -0
  78. python_lcms2-0.2.2/lcms2/icc/_interp.py +81 -0
  79. python_lcms2-0.2.2/lcms2/icc/_interp.pyi +8 -0
  80. python_lcms2-0.2.2/lcms2/icc/_io/__init__.py +3 -0
  81. python_lcms2-0.2.2/lcms2/icc/_io/__init__.pyi +0 -0
  82. python_lcms2-0.2.2/lcms2/icc/_io/binary.py +123 -0
  83. python_lcms2-0.2.2/lcms2/icc/_io/binary.pyi +52 -0
  84. python_lcms2-0.2.2/lcms2/icc/_io/constants.py +84 -0
  85. python_lcms2-0.2.2/lcms2/icc/_io/constants.pyi +63 -0
  86. python_lcms2-0.2.2/lcms2/icc/_io/curve_tags.py +171 -0
  87. python_lcms2-0.2.2/lcms2/icc/_io/curve_tags.pyi +46 -0
  88. python_lcms2-0.2.2/lcms2/icc/_io/mpe/__init__.py +46 -0
  89. python_lcms2-0.2.2/lcms2/icc/_io/mpe/__init__.pyi +47 -0
  90. python_lcms2-0.2.2/lcms2/icc/_io/mpe/calc.py +159 -0
  91. python_lcms2-0.2.2/lcms2/icc/_io/mpe/calc.pyi +18 -0
  92. python_lcms2-0.2.2/lcms2/icc/_io/mpe/calc_eval.py +191 -0
  93. python_lcms2-0.2.2/lcms2/icc/_io/mpe/calc_eval.pyi +12 -0
  94. python_lcms2-0.2.2/lcms2/icc/_io/mpe/container.py +68 -0
  95. python_lcms2-0.2.2/lcms2/icc/_io/mpe/container.pyi +13 -0
  96. python_lcms2-0.2.2/lcms2/icc/_io/mpe/curves.py +215 -0
  97. python_lcms2-0.2.2/lcms2/icc/_io/mpe/curves.pyi +21 -0
  98. python_lcms2-0.2.2/lcms2/icc/_io/mpe/elements.py +93 -0
  99. python_lcms2-0.2.2/lcms2/icc/_io/mpe/elements.pyi +9 -0
  100. python_lcms2-0.2.2/lcms2/icc/_io/profile.py +312 -0
  101. python_lcms2-0.2.2/lcms2/icc/_io/profile.pyi +70 -0
  102. python_lcms2-0.2.2/lcms2/icc/_io/tagtypes.py +306 -0
  103. python_lcms2-0.2.2/lcms2/icc/_io/tagtypes.pyi +32 -0
  104. python_lcms2-0.2.2/lcms2/icc/_io/text_tags.py +136 -0
  105. python_lcms2-0.2.2/lcms2/icc/_io/text_tags.pyi +35 -0
  106. python_lcms2-0.2.2/lcms2/icc/_pcs.py +62 -0
  107. python_lcms2-0.2.2/lcms2/icc/_pcs.pyi +7 -0
  108. python_lcms2-0.2.2/lcms2/icc/_reader.py +381 -0
  109. python_lcms2-0.2.2/lcms2/icc/_reader.pyi +50 -0
  110. python_lcms2-0.2.2/lcms2/icc/_space.py +125 -0
  111. python_lcms2-0.2.2/lcms2/icc/_space.pyi +24 -0
  112. python_lcms2-0.2.2/lcms2/icc/_tracer/__init__.py +3 -0
  113. python_lcms2-0.2.2/lcms2/icc/_tracer/__init__.pyi +0 -0
  114. python_lcms2-0.2.2/lcms2/icc/_tracer/calc.py +391 -0
  115. python_lcms2-0.2.2/lcms2/icc/_tracer/calc.pyi +7 -0
  116. python_lcms2-0.2.2/lcms2/icc/_tracer/chain.py +433 -0
  117. python_lcms2-0.2.2/lcms2/icc/_tracer/chain.pyi +9 -0
  118. python_lcms2-0.2.2/lcms2/icc/_tracer/optimize.py +184 -0
  119. python_lcms2-0.2.2/lcms2/icc/_tracer/optimize.pyi +3 -0
  120. python_lcms2-0.2.2/lcms2/icc/_tracer/probe.py +262 -0
  121. python_lcms2-0.2.2/lcms2/icc/_tracer/probe.pyi +23 -0
  122. python_lcms2-0.2.2/lcms2/icc/_tracer/tracing/__init__.py +35 -0
  123. python_lcms2-0.2.2/lcms2/icc/_tracer/tracing/__init__.pyi +31 -0
  124. python_lcms2-0.2.2/lcms2/icc/_tracer/tracing/array.py +446 -0
  125. python_lcms2-0.2.2/lcms2/icc/_tracer/tracing/array.pyi +120 -0
  126. python_lcms2-0.2.2/lcms2/icc/_tracer/tracing/functions.py +332 -0
  127. python_lcms2-0.2.2/lcms2/icc/_tracer/tracing/functions.pyi +6 -0
  128. python_lcms2-0.2.2/lcms2/icc/_tracer/tracing/graph.py +231 -0
  129. python_lcms2-0.2.2/lcms2/icc/_tracer/tracing/graph.pyi +36 -0
  130. python_lcms2-0.2.2/lcms2/icc/_tracer/tracing/session.py +141 -0
  131. python_lcms2-0.2.2/lcms2/icc/_tracer/tracing/session.pyi +5 -0
  132. python_lcms2-0.2.2/lcms2/icc/_versions.py +43 -0
  133. python_lcms2-0.2.2/lcms2/icc/_versions.pyi +3 -0
  134. python_lcms2-0.2.2/lcms2/icc/_writer/__init__.py +171 -0
  135. python_lcms2-0.2.2/lcms2/icc/_writer/__init__.pyi +30 -0
  136. python_lcms2-0.2.2/lcms2/icc/_writer/clut.py +83 -0
  137. python_lcms2-0.2.2/lcms2/icc/_writer/clut.pyi +13 -0
  138. python_lcms2-0.2.2/lcms2/icc/_writer/context.py +277 -0
  139. python_lcms2-0.2.2/lcms2/icc/_writer/context.pyi +48 -0
  140. python_lcms2-0.2.2/lcms2/icc/_writer/curves.py +212 -0
  141. python_lcms2-0.2.2/lcms2/icc/_writer/curves.pyi +57 -0
  142. python_lcms2-0.2.2/lcms2/icc/_writer/legacy_lut.py +232 -0
  143. python_lcms2-0.2.2/lcms2/icc/_writer/legacy_lut.pyi +10 -0
  144. python_lcms2-0.2.2/lcms2/icc/_writer/lut.py +230 -0
  145. python_lcms2-0.2.2/lcms2/icc/_writer/lut.pyi +18 -0
  146. python_lcms2-0.2.2/lcms2/icc/_writer/sampling.py +27 -0
  147. python_lcms2-0.2.2/lcms2/icc/_writer/sampling.pyi +11 -0
  148. python_lcms2-0.2.2/lcms2/icc/_writer/structure.py +160 -0
  149. python_lcms2-0.2.2/lcms2/icc/_writer/structure.pyi +21 -0
  150. python_lcms2-0.2.2/lcms2/icc/_writer/trc.py +73 -0
  151. python_lcms2-0.2.2/lcms2/icc/_writer/trc.pyi +13 -0
  152. python_lcms2-0.2.2/lcms2/icc/_writer/v5.py +74 -0
  153. python_lcms2-0.2.2/lcms2/icc/_writer/v5.pyi +17 -0
  154. python_lcms2-0.2.2/lcms2/icc/_writer/verify.py +46 -0
  155. python_lcms2-0.2.2/lcms2/icc/_writer/verify.pyi +16 -0
  156. python_lcms2-0.2.2/lcms2/py.typed +0 -0
  157. python_lcms2-0.2.2/lcms2/spaces/__init__.py +95 -0
  158. python_lcms2-0.2.2/lcms2/spaces/__init__.pyi +76 -0
  159. python_lcms2-0.2.2/lcms2/spaces/_a98_rgb.py +46 -0
  160. python_lcms2-0.2.2/lcms2/spaces/_a98_rgb.pyi +8 -0
  161. python_lcms2-0.2.2/lcms2/spaces/_base.py +433 -0
  162. python_lcms2-0.2.2/lcms2/spaces/_base.pyi +59 -0
  163. python_lcms2-0.2.2/lcms2/spaces/_cmyk.py +39 -0
  164. python_lcms2-0.2.2/lcms2/spaces/_cmyk.pyi +14 -0
  165. python_lcms2-0.2.2/lcms2/spaces/_display_p3.py +32 -0
  166. python_lcms2-0.2.2/lcms2/spaces/_display_p3.pyi +8 -0
  167. python_lcms2-0.2.2/lcms2/spaces/_display_p3_linear.py +20 -0
  168. python_lcms2-0.2.2/lcms2/spaces/_display_p3_linear.pyi +8 -0
  169. python_lcms2-0.2.2/lcms2/spaces/_domain.py +81 -0
  170. python_lcms2-0.2.2/lcms2/spaces/_domain.pyi +6 -0
  171. python_lcms2-0.2.2/lcms2/spaces/_gray.py +61 -0
  172. python_lcms2-0.2.2/lcms2/spaces/_gray.pyi +28 -0
  173. python_lcms2-0.2.2/lcms2/spaces/_hsv.py +65 -0
  174. python_lcms2-0.2.2/lcms2/spaces/_hsv.pyi +18 -0
  175. python_lcms2-0.2.2/lcms2/spaces/_hwb.py +43 -0
  176. python_lcms2-0.2.2/lcms2/spaces/_hwb.pyi +14 -0
  177. python_lcms2-0.2.2/lcms2/spaces/_lch.py +45 -0
  178. python_lcms2-0.2.2/lcms2/spaces/_lch.pyi +18 -0
  179. python_lcms2-0.2.2/lcms2/spaces/_loggray.py +61 -0
  180. python_lcms2-0.2.2/lcms2/spaces/_loggray.pyi +28 -0
  181. python_lcms2-0.2.2/lcms2/spaces/_oklab.py +52 -0
  182. python_lcms2-0.2.2/lcms2/spaces/_oklab.pyi +14 -0
  183. python_lcms2-0.2.2/lcms2/spaces/_oklch.py +33 -0
  184. python_lcms2-0.2.2/lcms2/spaces/_oklch.pyi +14 -0
  185. python_lcms2-0.2.2/lcms2/spaces/_prophoto_rgb.py +43 -0
  186. python_lcms2-0.2.2/lcms2/spaces/_prophoto_rgb.pyi +8 -0
  187. python_lcms2-0.2.2/lcms2/spaces/_rec2020.py +55 -0
  188. python_lcms2-0.2.2/lcms2/spaces/_rec2020.pyi +8 -0
  189. python_lcms2-0.2.2/lcms2/spaces/_rec2100_hlg.py +45 -0
  190. python_lcms2-0.2.2/lcms2/spaces/_rec2100_hlg.pyi +13 -0
  191. python_lcms2-0.2.2/lcms2/spaces/_rec2100_linear.py +20 -0
  192. python_lcms2-0.2.2/lcms2/spaces/_rec2100_linear.pyi +8 -0
  193. python_lcms2-0.2.2/lcms2/spaces/_rec2100_pq.py +45 -0
  194. python_lcms2-0.2.2/lcms2/spaces/_rec2100_pq.pyi +13 -0
  195. python_lcms2-0.2.2/lcms2/spaces/_rgb.py +54 -0
  196. python_lcms2-0.2.2/lcms2/spaces/_rgb.pyi +21 -0
  197. python_lcms2-0.2.2/lcms2/spaces/_srgb.py +55 -0
  198. python_lcms2-0.2.2/lcms2/spaces/_srgb.pyi +19 -0
  199. python_lcms2-0.2.2/lcms2/spaces/_srgb_linear.py +20 -0
  200. python_lcms2-0.2.2/lcms2/spaces/_srgb_linear.pyi +8 -0
  201. python_lcms2-0.2.2/lcms2/spaces/_xyz_d50.py +22 -0
  202. python_lcms2-0.2.2/lcms2/spaces/_xyz_d50.pyi +9 -0
  203. python_lcms2-0.2.2/lcms2/spaces/_xyz_d65.py +21 -0
  204. python_lcms2-0.2.2/lcms2/spaces/_xyz_d65.pyi +9 -0
  205. python_lcms2-0.2.2/pyproject.toml +136 -0
  206. python_lcms2-0.2.2/python_lcms2.egg-info/PKG-INFO +190 -0
  207. python_lcms2-0.2.2/python_lcms2.egg-info/SOURCES.txt +315 -0
  208. python_lcms2-0.2.2/python_lcms2.egg-info/requires.txt +25 -0
  209. python_lcms2-0.2.2/setup.py +33 -0
  210. python_lcms2-0.2.2/tests/__init__.py +0 -0
  211. python_lcms2-0.2.2/tests/cgats/__init__.py +0 -0
  212. python_lcms2-0.2.2/tests/cgats/test_cgats.py +129 -0
  213. python_lcms2-0.2.2/tests/colorimetry/__init__.py +0 -0
  214. python_lcms2-0.2.2/tests/colorimetry/test_delta_e.py +108 -0
  215. python_lcms2-0.2.2/tests/colorimetry/test_single_source.py +48 -0
  216. python_lcms2-0.2.2/tests/colorimetry/test_spaces_and_white.py +140 -0
  217. python_lcms2-0.2.2/tests/colormap/__init__.py +0 -0
  218. python_lcms2-0.2.2/tests/colormap/test_build.py +85 -0
  219. python_lcms2-0.2.2/tests/colormap/test_colormap.py +101 -0
  220. python_lcms2-0.2.2/tests/colormap/test_diagnostics.py +64 -0
  221. python_lcms2-0.2.2/tests/colormap/test_export.py +105 -0
  222. python_lcms2-0.2.2/tests/colormap/test_from_colors_uniform.py +23 -0
  223. python_lcms2-0.2.2/tests/colormap/test_generators.py +73 -0
  224. python_lcms2-0.2.2/tests/colormap/test_parallel_call.py +34 -0
  225. python_lcms2-0.2.2/tests/colormap/test_parse.py +86 -0
  226. python_lcms2-0.2.2/tests/conftest.py +26 -0
  227. python_lcms2-0.2.2/tests/core/__init__.py +0 -0
  228. python_lcms2-0.2.2/tests/core/test_convert.py +110 -0
  229. python_lcms2-0.2.2/tests/core/test_convert_text.py +39 -0
  230. python_lcms2-0.2.2/tests/core/test_explicit.py +77 -0
  231. python_lcms2-0.2.2/tests/core/test_formats.py +78 -0
  232. python_lcms2-0.2.2/tests/core/test_profile.py +189 -0
  233. python_lcms2-0.2.2/tests/core/test_threads.py +56 -0
  234. python_lcms2-0.2.2/tests/core/test_transform.py +173 -0
  235. python_lcms2-0.2.2/tests/curves/__init__.py +0 -0
  236. python_lcms2-0.2.2/tests/curves/test_tone_curve.py +141 -0
  237. python_lcms2-0.2.2/tests/data/CMYK.icm +0 -0
  238. python_lcms2-0.2.2/tests/data/empty.icm +1 -0
  239. python_lcms2-0.2.2/tests/data/profiles/AdobeCompat-v2.icc +0 -0
  240. python_lcms2-0.2.2/tests/data/profiles/CGATS001Compat-v2-micro.icc +0 -0
  241. python_lcms2-0.2.2/tests/data/profiles/DisplayP3-v4.icc +0 -0
  242. python_lcms2-0.2.2/tests/data/profiles/FOGRA39L_coated.icc +0 -0
  243. python_lcms2-0.2.2/tests/data/profiles/ProPhoto-v2-micro.icc +0 -0
  244. python_lcms2-0.2.2/tests/data/profiles/ProPhoto-v4.icc +0 -0
  245. python_lcms2-0.2.2/tests/data/profiles/bad.icc +21 -0
  246. python_lcms2-0.2.2/tests/data/profiles/ibm-t61.icc +0 -0
  247. python_lcms2-0.2.2/tests/data/profiles/sRGB-v2-micro.icc +0 -0
  248. python_lcms2-0.2.2/tests/data/profiles/sRGB-v4.icc +0 -0
  249. python_lcms2-0.2.2/tests/data/profiles/sRGB_texlive.icc +0 -0
  250. python_lcms2-0.2.2/tests/data/profiles/test1.icc +0 -0
  251. python_lcms2-0.2.2/tests/data/profiles/test2.icc +0 -0
  252. python_lcms2-0.2.2/tests/data/profiles/test3.icc +0 -0
  253. python_lcms2-0.2.2/tests/data/profiles/test4.icc +0 -0
  254. python_lcms2-0.2.2/tests/data/profiles/test5.icc +0 -0
  255. python_lcms2-0.2.2/tests/data/profiles/toosmall.icc +0 -0
  256. python_lcms2-0.2.2/tests/data/sRGB.icm +0 -0
  257. python_lcms2-0.2.2/tests/icc/__init__.py +0 -0
  258. python_lcms2-0.2.2/tests/icc/test_binary.py +30 -0
  259. python_lcms2-0.2.2/tests/icc/test_icc_version_validation.py +64 -0
  260. python_lcms2-0.2.2/tests/icc/test_iccmax_conformance.py +51 -0
  261. python_lcms2-0.2.2/tests/icc/test_lcms_conformance.py +137 -0
  262. python_lcms2-0.2.2/tests/icc/test_lcms_cross_validation.py +154 -0
  263. python_lcms2-0.2.2/tests/icc/test_malformed.py +84 -0
  264. python_lcms2-0.2.2/tests/icc/test_optimize.py +155 -0
  265. python_lcms2-0.2.2/tests/icc/test_read_real_profiles.py +80 -0
  266. python_lcms2-0.2.2/tests/icc/test_tracer_array_support.py +301 -0
  267. python_lcms2-0.2.2/tests/icc/test_tracer_corpus.py +1219 -0
  268. python_lcms2-0.2.2/tests/icc/test_tracer_fuzz.py +84 -0
  269. python_lcms2-0.2.2/tests/icc/test_tracing_robustness.py +279 -0
  270. python_lcms2-0.2.2/tests/spaces/__init__.py +0 -0
  271. python_lcms2-0.2.2/tests/spaces/test_channel_validation.py +74 -0
  272. python_lcms2-0.2.2/tests/spaces/test_colorspace_base.py +61 -0
  273. python_lcms2-0.2.2/tests/spaces/test_css4_extra_colorspaces.py +295 -0
  274. python_lcms2-0.2.2/tests/spaces/test_custom_spaces.py +421 -0
  275. python_lcms2-0.2.2/tests/spaces/test_device_domain.py +91 -0
  276. python_lcms2-0.2.2/tests/spaces/test_rec2100_colorspaces.py +128 -0
  277. python_lcms2-0.2.2/tests/spaces/test_registry.py +135 -0
  278. python_lcms2-0.2.2/tests/spaces/test_regressions.py +205 -0
  279. python_lcms2-0.2.2/tests/spaces/test_shape_support.py +100 -0
  280. python_lcms2-0.2.2/tests/spaces/test_web_colorspaces.py +295 -0
  281. python_lcms2-0.2.2/tests/spaces/toys.py +22 -0
  282. python_lcms2-0.2.2/tests/test_package_boundaries.py +125 -0
  283. python_lcms2-0.2.2/tests/test_package_exports.py +104 -0
  284. python_lcms2-0.2.2/vendor/Little-CMS/LICENSE +22 -0
  285. python_lcms2-0.2.2/vendor/Little-CMS/include/lcms2.h +2031 -0
  286. python_lcms2-0.2.2/vendor/Little-CMS/include/lcms2_plugin.h +730 -0
  287. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmsalpha.c +2 -2
  288. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmscam02.c +23 -18
  289. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmscgats.c +79 -23
  290. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmscnvrt.c +38 -17
  291. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmserr.c +92 -8
  292. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmsgamma.c +2 -1
  293. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmsgmt.c +1 -1
  294. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmshalf.c +1 -1
  295. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmsintrp.c +9 -9
  296. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmsio0.c +308 -92
  297. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmsio1.c +8 -2
  298. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmslut.c +8 -7
  299. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmsmd5.c +1 -1
  300. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmsmtrx.c +1 -1
  301. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmsnamed.c +23 -14
  302. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmsopt.c +39 -11
  303. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmspack.c +12 -8
  304. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmspcs.c +1 -1
  305. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmsplugin.c +17 -4
  306. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmsps2.c +36 -4
  307. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmssamp.c +56 -6
  308. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmssm.c +1 -1
  309. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmstypes.c +90 -29
  310. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmsvirt.c +46 -21
  311. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmswtpnt.c +1 -1
  312. {python_lcms2-0.1.1 → python_lcms2-0.2.2/vendor}/Little-CMS/src/cmsxform.c +51 -6
  313. python_lcms2-0.2.2/vendor/Little-CMS/src/lcms2_internal.h +1176 -0
  314. python_lcms2-0.1.1/PKG-INFO +0 -200
  315. python_lcms2-0.1.1/README.md +0 -180
  316. python_lcms2-0.1.1/pyproject.toml +0 -36
  317. python_lcms2-0.1.1/setup.py +0 -103
  318. python_lcms2-0.1.1/src/lcms2/__init__.py +0 -132
  319. python_lcms2-0.1.1/src/lcms2/_lcms2.c +0 -89
  320. python_lcms2-0.1.1/src/lcms2/implementation.py +0 -221
  321. python_lcms2-0.1.1/src/python_lcms2.egg-info/PKG-INFO +0 -200
  322. python_lcms2-0.1.1/src/python_lcms2.egg-info/SOURCES.txt +0 -45
  323. python_lcms2-0.1.1/src/python_lcms2.egg-info/requires.txt +0 -1
  324. python_lcms2-0.1.1/tests/test_builtin_profiles.py +0 -29
  325. python_lcms2-0.1.1/tests/test_profile_file_io.py +0 -53
  326. python_lcms2-0.1.1/tests/test_profile_memory_io.py +0 -33
  327. python_lcms2-0.1.1/tests/test_readme_examples.py +0 -143
  328. python_lcms2-0.1.1/tests/test_rgb_profiles.py +0 -18
  329. python_lcms2-0.1.1/tests/test_transforms.py +0 -71
  330. python_lcms2-0.1.1/tests/test_white_point.py +0 -45
  331. {python_lcms2-0.1.1 → python_lcms2-0.2.2}/LICENSE +0 -0
  332. {python_lcms2-0.1.1/src → python_lcms2-0.2.2}/python_lcms2.egg-info/dependency_links.txt +0 -0
  333. {python_lcms2-0.1.1/src → python_lcms2-0.2.2}/python_lcms2.egg-info/top_level.txt +0 -0
  334. {python_lcms2-0.1.1 → python_lcms2-0.2.2}/setup.cfg +0 -0
@@ -0,0 +1,9 @@
1
+ include LICENSE README.md setup.py
2
+ recursive-include lcms2 *.py *.pyi *.c *.h py.typed *.csv *.json *.icc *.icm
3
+ recursive-include vendor/Little-CMS/src *.c *.h
4
+ recursive-include vendor/Little-CMS/include *.h
5
+ include vendor/Little-CMS/LICENSE vendor/Little-CMS/COPYING
6
+ recursive-include tests *.py *.icm *.icc
7
+ prune vendor/Little-CMS/testbed
8
+ prune vendor/Little-CMS/utils
9
+ global-exclude *.pyd *.so __pycache__ *.pyc
@@ -0,0 +1,190 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-lcms2
3
+ Version: 0.2.2
4
+ Summary: Color management for NumPy: LittleCMS2 bindings, color spaces, ICC profile authoring and colormaps
5
+ Author-email: Josue N Rivera <josuevaldez1.com@gmail.com>
6
+ License-Expression: GPL-3.0-or-later
7
+ Project-URL: Homepage, https://github.com/wzjoriv/python-lcms2
8
+ Project-URL: Repository, https://github.com/wzjoriv/python-lcms2
9
+ Project-URL: Bug Tracker, https://github.com/wzjoriv/python-lcms2/issues
10
+ Keywords: color management,lcms2,littlecms,icc,color profile,colorspace,oklab,colormap,delta e,ciecam02
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: C
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
23
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ License-File: vendor/Little-CMS/LICENSE
29
+ Requires-Dist: numpy>=2.0
30
+ Provides-Extra: plot
31
+ Requires-Dist: matplotlib>=3.7; extra == "plot"
32
+ Provides-Extra: test
33
+ Requires-Dist: pytest>=7.0; extra == "test"
34
+ Requires-Dist: pillow>=10; extra == "test"
35
+ Requires-Dist: typer>=0.12; extra == "test"
36
+ Provides-Extra: docs
37
+ Requires-Dist: sphinx>=7.0; extra == "docs"
38
+ Requires-Dist: furo>=2024.1.29; extra == "docs"
39
+ Requires-Dist: myst-parser>=2.0; extra == "docs"
40
+ Provides-Extra: dev
41
+ Requires-Dist: python-lcms2[docs,plot,test]; extra == "dev"
42
+ Requires-Dist: pytest-cov; extra == "dev"
43
+ Requires-Dist: ruff>=0.6; extra == "dev"
44
+ Requires-Dist: typer>=0.12; extra == "dev"
45
+ Requires-Dist: stubpy>=0.8.2; extra == "dev"
46
+ Requires-Dist: build; extra == "dev"
47
+ Requires-Dist: tomli; python_version < "3.11" and extra == "dev"
48
+ Dynamic: license-file
49
+
50
+ # python-lcms2
51
+
52
+ Color management for NumPy. Convert images between ICC profiles and color spaces in one call, measure color
53
+ differences, build exact ICC profiles from your own NumPy color math, and make perceptually uniform colormaps,
54
+ all backed by [LittleCMS 2](https://github.com/mm2/Little-CMS).
55
+
56
+ [![Tests](https://github.com/wzjoriv/python-lcms2/actions/workflows/ci.yml/badge.svg)](https://github.com/wzjoriv/python-lcms2/actions/workflows/ci.yml)
57
+ [![Docs](https://github.com/wzjoriv/python-lcms2/actions/workflows/docs.yml/badge.svg)](https://github.com/wzjoriv/python-lcms2/actions/workflows/docs.yml)
58
+ [![PyPI](https://img.shields.io/pypi/v/python-lcms2)](https://pypi.org/project/python-lcms2/)
59
+ [![Python](https://img.shields.io/pypi/pyversions/python-lcms2)](https://pypi.org/project/python-lcms2/)
60
+ [![LittleCMS 2.20](https://img.shields.io/badge/LittleCMS-2.20-blue)](https://github.com/mm2/Little-CMS)
61
+ [![License: GPL v3+](https://img.shields.io/badge/License-GPLv3+-blue.svg)](LICENSE)
62
+ [![Documentation](https://img.shields.io/badge/docs-wzjoriv.github.io%2Fpython--lcms2-blue)](https://wzjoriv.github.io/python-lcms2)
63
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
64
+
65
+ ## Features
66
+
67
+ | Feature | What you get |
68
+ |---|---|
69
+ | One-call conversion | `lcms2.convert(img, "sRGB", "Display P3")`: pixel formats come from the array's dtype and shape. |
70
+ | Profiles | 25 built-ins (sRGB, Display P3, Adobe RGB, ProPhoto, Rec.2020, Lab, XYZ, …), ICC files, bytes; read and edit header, text and tags. |
71
+ | Transforms | Rendering intents, black-point compensation, soft proofing with gamut check, multi-profile chains, device links. |
72
+ | Fast and safe | The GIL is released during transforms; any contiguity or stride; alpha channels carried through. |
73
+ | Color spaces | OKLab, OKLCh, CIE LCh, HSV, HWB, Display P3, Rec.2100 PQ/HLG, … as NumPy functions, mixed freely with ICC profiles. |
74
+ | ICC authoring | `lcms2.Profile(my_space)` traces your NumPy `to_xyz`/`from_xyz` into an exact ICC v4/v5 profile. |
75
+ | Colorimetry | ΔE 76/94/2000/CMC/BFD, CIECAM02, white point ⇄ color temperature, chromatic adaptation. |
76
+ | Tone curves | Gamma, parametric and tabulated curves; evaluate, invert, join, estimate gamma. |
77
+ | Colormaps | Perceptually uniform colormaps in OKLab, gamut-mapped, color-vision-deficiency simulation, matplotlib export. |
78
+ | Measurement data | Read and write CGATS / IT8 files. |
79
+
80
+ Wheels for Windows, Linux and macOS (x86-64 and ARM64) on Python 3.10 and later. NumPy is the only dependency.
81
+
82
+ ## Install
83
+
84
+ ```bash
85
+ pip install python-lcms2
86
+ pip install "python-lcms2[plot]" # + matplotlib for colormap export
87
+ ```
88
+
89
+ ## Use
90
+
91
+ ```python
92
+ import numpy as np
93
+ import lcms2
94
+
95
+ img = np.asarray(...) # (H, W, 3) uint8, e.g. from Pillow or OpenCV
96
+
97
+ p3 = lcms2.convert(img, "sRGB", "Display P3") # uint8 in, uint8 out
98
+ lab = lcms2.Profile("sRGB").transform(img, "Lab") # float64 L*a*b*
99
+
100
+ lcms2.convert([255, 0, 0], "sRGB", "Lab", intent="relative")
101
+ # array([54.29, 80.81, 69.89])
102
+ lcms2.convert([255, 0, 0], "sRGB", "oklab")
103
+ # array([0.6279, 0.2249, 0.1258])
104
+ ```
105
+
106
+ Reuse a `Transform` when converting many images; formats are resolved per input and cached:
107
+
108
+ ```python
109
+ to_cmyk = lcms2.Transform("sRGB", lcms2.Profile("press.icc"), intent="relative", bpc=True)
110
+ cmyk = to_cmyk(img) # (H, W, 4) uint8
111
+ ```
112
+
113
+ ### Profiles
114
+
115
+ ```python
116
+ srgb = lcms2.Profile("sRGB") # built-in (case-insensitive: "display p3", "adobe rgb", …)
117
+ cmyk = lcms2.Profile("press.icc") # a file
118
+ web = lcms2.Profile.from_bytes(icc_bytes) # bytes, e.g. embedded in an image
119
+
120
+ cmyk # <Profile 'Fogra27L CMYK Coated Press' CMYK output v2.2>
121
+ cmyk.color_space, cmyk.device_class, cmyk.tags
122
+ cmyk.description = "Press proof"
123
+ cmyk.save("press-v2.icc")
124
+ ```
125
+
126
+ ### Soft proofing
127
+
128
+ ```python
129
+ proof = lcms2.Transform(srgb, srgb, proof=cmyk, gamut_check=True)
130
+ proof(img) # how img prints; out-of-gamut pixels marked gray
131
+ ```
132
+
133
+ ### Your own color space, as an ICC profile
134
+
135
+ ```python
136
+ from lcms2.spaces import ColorSpace
137
+
138
+ class Gamma18(ColorSpace):
139
+ n_channels = 3
140
+ def to_xyz(self, rgb):
141
+ return (rgb ** 1.8) @ M.T # M: your 3x3 RGB→XYZ (D50) matrix
142
+ def from_xyz(self, xyz):
143
+ return (xyz @ M_inv.T) ** (1 / 1.8)
144
+
145
+ profile = lcms2.Profile(Gamma18()) # exact matrix/TRC profile, usable in any CMS
146
+ profile.save("gamma18.icc")
147
+ lcms2.convert(img, profile, "sRGB")
148
+ ```
149
+
150
+ Built-in analytic spaces (`lcms2.spaces.oklab`, `oklch`, `hsv`, `display_p3`, `rec2100_pq`, …) work the same
151
+ way: `lcms2.spaces.oklab.profile` is an ICC profile of OKLab.
152
+
153
+ ### Color differences
154
+
155
+ ```python
156
+ lcms2.delta_e(lab1, lab2) # CIEDE2000, vectorized over (..., 3)
157
+ lcms2.delta_e(lab1, lab2, method="cmc", l=2, c=1)
158
+ ```
159
+
160
+ ### Colormaps
161
+
162
+ ```python
163
+ cm = lcms2.Colormap.from_colors(["#0b1a3a", "#f08a24", "#fff6d5"]) # interpolated in OKLab
164
+ cm = lcms2.Colormap.get("glacier") # built-ins: lcms2.colormap.list()
165
+
166
+ rgb = cm(values) # (..., 3) floats; bytes=True for uint8
167
+ cm.is_lightness_monotonic(), cm.uniformity()
168
+ cm.simulate("deuteranopia") # color-vision-deficiency preview
169
+ plt.imshow(data, cmap=cm.to_matplotlib())
170
+ ```
171
+
172
+ ## Documentation
173
+
174
+ Guides and the API reference: <https://wzjoriv.github.io/python-lcms2>.
175
+
176
+ ## Building from source
177
+
178
+ ```bash
179
+ git clone --recurse-submodules https://github.com/wzjoriv/python-lcms2.git
180
+ cd python-lcms2
181
+ pip install -e ".[dev]"
182
+ python scripts/dev.py check # lint + tests
183
+ ```
184
+
185
+ A C compiler is needed (MSVC on Windows, gcc/clang elsewhere). LittleCMS is vendored as a git submodule in
186
+ `vendor/Little-CMS`; `python scripts/dev.py lcms2 update` moves it to the newest release.
187
+
188
+ ## License
189
+
190
+ GPL-3.0-or-later. LittleCMS is © Marti Maria Saguer, MIT license (`vendor/Little-CMS/LICENSE`).
@@ -0,0 +1,141 @@
1
+ # python-lcms2
2
+
3
+ Color management for NumPy. Convert images between ICC profiles and color spaces in one call, measure color
4
+ differences, build exact ICC profiles from your own NumPy color math, and make perceptually uniform colormaps,
5
+ all backed by [LittleCMS 2](https://github.com/mm2/Little-CMS).
6
+
7
+ [![Tests](https://github.com/wzjoriv/python-lcms2/actions/workflows/ci.yml/badge.svg)](https://github.com/wzjoriv/python-lcms2/actions/workflows/ci.yml)
8
+ [![Docs](https://github.com/wzjoriv/python-lcms2/actions/workflows/docs.yml/badge.svg)](https://github.com/wzjoriv/python-lcms2/actions/workflows/docs.yml)
9
+ [![PyPI](https://img.shields.io/pypi/v/python-lcms2)](https://pypi.org/project/python-lcms2/)
10
+ [![Python](https://img.shields.io/pypi/pyversions/python-lcms2)](https://pypi.org/project/python-lcms2/)
11
+ [![LittleCMS 2.20](https://img.shields.io/badge/LittleCMS-2.20-blue)](https://github.com/mm2/Little-CMS)
12
+ [![License: GPL v3+](https://img.shields.io/badge/License-GPLv3+-blue.svg)](LICENSE)
13
+ [![Documentation](https://img.shields.io/badge/docs-wzjoriv.github.io%2Fpython--lcms2-blue)](https://wzjoriv.github.io/python-lcms2)
14
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
15
+
16
+ ## Features
17
+
18
+ | Feature | What you get |
19
+ |---|---|
20
+ | One-call conversion | `lcms2.convert(img, "sRGB", "Display P3")`: pixel formats come from the array's dtype and shape. |
21
+ | Profiles | 25 built-ins (sRGB, Display P3, Adobe RGB, ProPhoto, Rec.2020, Lab, XYZ, …), ICC files, bytes; read and edit header, text and tags. |
22
+ | Transforms | Rendering intents, black-point compensation, soft proofing with gamut check, multi-profile chains, device links. |
23
+ | Fast and safe | The GIL is released during transforms; any contiguity or stride; alpha channels carried through. |
24
+ | Color spaces | OKLab, OKLCh, CIE LCh, HSV, HWB, Display P3, Rec.2100 PQ/HLG, … as NumPy functions, mixed freely with ICC profiles. |
25
+ | ICC authoring | `lcms2.Profile(my_space)` traces your NumPy `to_xyz`/`from_xyz` into an exact ICC v4/v5 profile. |
26
+ | Colorimetry | ΔE 76/94/2000/CMC/BFD, CIECAM02, white point ⇄ color temperature, chromatic adaptation. |
27
+ | Tone curves | Gamma, parametric and tabulated curves; evaluate, invert, join, estimate gamma. |
28
+ | Colormaps | Perceptually uniform colormaps in OKLab, gamut-mapped, color-vision-deficiency simulation, matplotlib export. |
29
+ | Measurement data | Read and write CGATS / IT8 files. |
30
+
31
+ Wheels for Windows, Linux and macOS (x86-64 and ARM64) on Python 3.10 and later. NumPy is the only dependency.
32
+
33
+ ## Install
34
+
35
+ ```bash
36
+ pip install python-lcms2
37
+ pip install "python-lcms2[plot]" # + matplotlib for colormap export
38
+ ```
39
+
40
+ ## Use
41
+
42
+ ```python
43
+ import numpy as np
44
+ import lcms2
45
+
46
+ img = np.asarray(...) # (H, W, 3) uint8, e.g. from Pillow or OpenCV
47
+
48
+ p3 = lcms2.convert(img, "sRGB", "Display P3") # uint8 in, uint8 out
49
+ lab = lcms2.Profile("sRGB").transform(img, "Lab") # float64 L*a*b*
50
+
51
+ lcms2.convert([255, 0, 0], "sRGB", "Lab", intent="relative")
52
+ # array([54.29, 80.81, 69.89])
53
+ lcms2.convert([255, 0, 0], "sRGB", "oklab")
54
+ # array([0.6279, 0.2249, 0.1258])
55
+ ```
56
+
57
+ Reuse a `Transform` when converting many images; formats are resolved per input and cached:
58
+
59
+ ```python
60
+ to_cmyk = lcms2.Transform("sRGB", lcms2.Profile("press.icc"), intent="relative", bpc=True)
61
+ cmyk = to_cmyk(img) # (H, W, 4) uint8
62
+ ```
63
+
64
+ ### Profiles
65
+
66
+ ```python
67
+ srgb = lcms2.Profile("sRGB") # built-in (case-insensitive: "display p3", "adobe rgb", …)
68
+ cmyk = lcms2.Profile("press.icc") # a file
69
+ web = lcms2.Profile.from_bytes(icc_bytes) # bytes, e.g. embedded in an image
70
+
71
+ cmyk # <Profile 'Fogra27L CMYK Coated Press' CMYK output v2.2>
72
+ cmyk.color_space, cmyk.device_class, cmyk.tags
73
+ cmyk.description = "Press proof"
74
+ cmyk.save("press-v2.icc")
75
+ ```
76
+
77
+ ### Soft proofing
78
+
79
+ ```python
80
+ proof = lcms2.Transform(srgb, srgb, proof=cmyk, gamut_check=True)
81
+ proof(img) # how img prints; out-of-gamut pixels marked gray
82
+ ```
83
+
84
+ ### Your own color space, as an ICC profile
85
+
86
+ ```python
87
+ from lcms2.spaces import ColorSpace
88
+
89
+ class Gamma18(ColorSpace):
90
+ n_channels = 3
91
+ def to_xyz(self, rgb):
92
+ return (rgb ** 1.8) @ M.T # M: your 3x3 RGB→XYZ (D50) matrix
93
+ def from_xyz(self, xyz):
94
+ return (xyz @ M_inv.T) ** (1 / 1.8)
95
+
96
+ profile = lcms2.Profile(Gamma18()) # exact matrix/TRC profile, usable in any CMS
97
+ profile.save("gamma18.icc")
98
+ lcms2.convert(img, profile, "sRGB")
99
+ ```
100
+
101
+ Built-in analytic spaces (`lcms2.spaces.oklab`, `oklch`, `hsv`, `display_p3`, `rec2100_pq`, …) work the same
102
+ way: `lcms2.spaces.oklab.profile` is an ICC profile of OKLab.
103
+
104
+ ### Color differences
105
+
106
+ ```python
107
+ lcms2.delta_e(lab1, lab2) # CIEDE2000, vectorized over (..., 3)
108
+ lcms2.delta_e(lab1, lab2, method="cmc", l=2, c=1)
109
+ ```
110
+
111
+ ### Colormaps
112
+
113
+ ```python
114
+ cm = lcms2.Colormap.from_colors(["#0b1a3a", "#f08a24", "#fff6d5"]) # interpolated in OKLab
115
+ cm = lcms2.Colormap.get("glacier") # built-ins: lcms2.colormap.list()
116
+
117
+ rgb = cm(values) # (..., 3) floats; bytes=True for uint8
118
+ cm.is_lightness_monotonic(), cm.uniformity()
119
+ cm.simulate("deuteranopia") # color-vision-deficiency preview
120
+ plt.imshow(data, cmap=cm.to_matplotlib())
121
+ ```
122
+
123
+ ## Documentation
124
+
125
+ Guides and the API reference: <https://wzjoriv.github.io/python-lcms2>.
126
+
127
+ ## Building from source
128
+
129
+ ```bash
130
+ git clone --recurse-submodules https://github.com/wzjoriv/python-lcms2.git
131
+ cd python-lcms2
132
+ pip install -e ".[dev]"
133
+ python scripts/dev.py check # lint + tests
134
+ ```
135
+
136
+ A C compiler is needed (MSVC on Windows, gcc/clang elsewhere). LittleCMS is vendored as a git submodule in
137
+ `vendor/Little-CMS`; `python scripts/dev.py lcms2 update` moves it to the newest release.
138
+
139
+ ## License
140
+
141
+ GPL-3.0-or-later. LittleCMS is © Marti Maria Saguer, MIT license (`vendor/Little-CMS/LICENSE`).
@@ -0,0 +1,76 @@
1
+ """
2
+ Color management for NumPy, built on LittleCMS2.
3
+
4
+ Examples
5
+ --------
6
+ >>> import numpy as np, lcms2
7
+ >>> lcms2.convert(np.array([255, 0, 0], np.uint8), "sRGB", "Lab", intent="relative").round(2)
8
+ array([54.29, 80.81, 69.89])
9
+ """
10
+
11
+ __version__ = "0.2.2"
12
+ __author__ = "Josue N Rivera"
13
+
14
+ from . import _lcms2, cgats, colorimetry, colormap, icc, spaces
15
+ from ._constants import ColorSpaceSignature, DeviceClass, Flag, Intent
16
+ from ._convert import convert
17
+ from ._curves import ToneCurve
18
+ from ._data import RGB_SPACES, WHITE_POINTS
19
+ from ._errors import CMSError, ICCParseError, ICCWriteError
20
+ from ._formats import FORMATS
21
+ from ._parallel import get_threads, set_threads
22
+ from ._parse import parse_color, parse_colors, to_hex
23
+ from ._profile import Profile
24
+ from ._transform import (
25
+ Transform,
26
+ get_alarm_codes,
27
+ set_adaptation_state,
28
+ set_alarm_codes,
29
+ )
30
+ from .cgats import CGATS
31
+ from .colorimetry import CIECAM02, delta_e
32
+ from .colormap import Colormap
33
+ from .spaces import ColorSpace
34
+
35
+
36
+ def get_version() -> str:
37
+ """Version of the linked LittleCMS library, e.g. ``"2.20"``."""
38
+ v = _lcms2.get_version()
39
+ return f"{v // 1000}.{v % 1000 // 10}"
40
+
41
+
42
+ __all__ = [
43
+ "CGATS",
44
+ "CIECAM02",
45
+ "ColorSpace",
46
+ "Colormap",
47
+ "ToneCurve",
48
+ "cgats",
49
+ "colorimetry",
50
+ "colormap",
51
+ "delta_e",
52
+ "icc",
53
+ "parse_color",
54
+ "parse_colors",
55
+ "spaces",
56
+ "to_hex",
57
+ "CMSError",
58
+ "ICCParseError",
59
+ "ICCWriteError",
60
+ "ColorSpaceSignature",
61
+ "DeviceClass",
62
+ "FORMATS",
63
+ "Flag",
64
+ "Intent",
65
+ "Profile",
66
+ "RGB_SPACES",
67
+ "Transform",
68
+ "WHITE_POINTS",
69
+ "convert",
70
+ "get_alarm_codes",
71
+ "get_version",
72
+ "set_adaptation_state",
73
+ "set_alarm_codes",
74
+ "set_threads",
75
+ "get_threads",
76
+ ]
@@ -0,0 +1,76 @@
1
+ from . import (
2
+ cgats as cgats,
3
+ colorimetry as colorimetry,
4
+ colormap as colormap,
5
+ icc as icc,
6
+ spaces as spaces,
7
+ )
8
+ from ._constants import (
9
+ ColorSpaceSignature as ColorSpaceSignature,
10
+ DeviceClass as DeviceClass,
11
+ Flag as Flag,
12
+ Intent as Intent,
13
+ )
14
+ from ._convert import convert as convert
15
+ from ._curves import ToneCurve as ToneCurve
16
+ from ._data import RGB_SPACES as RGB_SPACES, WHITE_POINTS as WHITE_POINTS
17
+ from ._errors import (
18
+ CMSError as CMSError,
19
+ ICCParseError as ICCParseError,
20
+ ICCWriteError as ICCWriteError,
21
+ )
22
+ from ._formats import FORMATS as FORMATS
23
+ from ._parallel import get_threads as get_threads, set_threads as set_threads
24
+ from ._parse import parse_color as parse_color, parse_colors as parse_colors, to_hex as to_hex
25
+ from ._profile import Profile as Profile
26
+ from ._transform import (
27
+ Transform as Transform,
28
+ get_alarm_codes as get_alarm_codes,
29
+ set_adaptation_state as set_adaptation_state,
30
+ set_alarm_codes as set_alarm_codes,
31
+ )
32
+ from .cgats import CGATS as CGATS
33
+ from .colorimetry import CIECAM02 as CIECAM02, delta_e as delta_e
34
+ from .colormap import Colormap as Colormap
35
+ from .spaces import ColorSpace as ColorSpace
36
+
37
+ __all__ = [
38
+ "CGATS",
39
+ "CIECAM02",
40
+ "ColorSpace",
41
+ "Colormap",
42
+ "ToneCurve",
43
+ "cgats",
44
+ "colorimetry",
45
+ "colormap",
46
+ "delta_e",
47
+ "icc",
48
+ "parse_color",
49
+ "parse_colors",
50
+ "spaces",
51
+ "to_hex",
52
+ "CMSError",
53
+ "ICCParseError",
54
+ "ICCWriteError",
55
+ "ColorSpaceSignature",
56
+ "DeviceClass",
57
+ "FORMATS",
58
+ "Flag",
59
+ "Intent",
60
+ "Profile",
61
+ "RGB_SPACES",
62
+ "Transform",
63
+ "WHITE_POINTS",
64
+ "convert",
65
+ "get_alarm_codes",
66
+ "get_version",
67
+ "set_adaptation_state",
68
+ "set_alarm_codes",
69
+ "set_threads",
70
+ "get_threads",
71
+ ]
72
+
73
+ __version__: str
74
+ __author__: str
75
+
76
+ def get_version() -> str: ...
@@ -0,0 +1,150 @@
1
+ """
2
+ Built-in profile names, aliases and white point resolution.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ import re
8
+ from collections.abc import Callable, Sequence
9
+ from typing import Any
10
+
11
+ from . import _lcms2
12
+ from ._data import RGB_SPACES, WHITE_POINTS
13
+
14
+ __all__ = ["builtin_names", "create_builtin", "lookup_builtin", "resolve_white_point"]
15
+
16
+ WhitePoint = str | float | Sequence[float] | None
17
+
18
+
19
+ def _norm(name: str) -> str:
20
+ return re.sub(r"[^a-z0-9]", "", name.lower())
21
+
22
+
23
+ def _rgb(name: str) -> Callable[[], Any]:
24
+ def make() -> Any:
25
+ s = RGB_SPACES[name]
26
+ return _lcms2.profile_create_rgb(resolve_white_point(s["white_point"]), s["primaries"], [s["curve"]])
27
+
28
+ return make
29
+
30
+
31
+ #: canonical name -> factory returning a profile capsule
32
+ _FACTORIES: dict[str, Callable[[], Any]] = {
33
+ "sRGB": _lcms2.profile_create_srgb,
34
+ "Lab": lambda: _lcms2.profile_create_lab(4, None),
35
+ "Lab v2": lambda: _lcms2.profile_create_lab(2, None),
36
+ "XYZ": _lcms2.profile_create_xyz,
37
+ "NULL": _lcms2.profile_create_null,
38
+ **{name: _rgb(name) for name in RGB_SPACES},
39
+ }
40
+
41
+ _ALIASES = {
42
+ "adobergb": "Adobe RGB (1998)",
43
+ "adobe": "Adobe RGB (1998)",
44
+ "argb": "Adobe RGB (1998)",
45
+ "p3": "Display P3",
46
+ "displayp3": "Display P3",
47
+ "dcip3": "DCI-P3",
48
+ "rec2020": "Rec.2020",
49
+ "bt2020": "Rec.2020",
50
+ "rec709": "Rec.709",
51
+ "bt709": "Rec.709",
52
+ "prophoto": "ProPhoto RGB",
53
+ "romm": "ProPhoto RGB",
54
+ "romm rgb": "ProPhoto RGB",
55
+ "ecirgb": "ECI RGB v2",
56
+ "widegamut": "Wide Gamut RGB",
57
+ "pal": "PAL/SECAM RGB",
58
+ "secam": "PAL/SECAM RGB",
59
+ "smptec": "SMPTE-C RGB",
60
+ "ntsc": "NTSC RGB",
61
+ "cielab": "Lab",
62
+ "lab4": "Lab",
63
+ "labv4": "Lab",
64
+ "lab2": "Lab v2",
65
+ "ciexyz": "XYZ",
66
+ }
67
+
68
+
69
+ def _build_index() -> dict[str, str]:
70
+ index: dict[str, str] = {}
71
+ for name in _FACTORIES:
72
+ if name.startswith("_"):
73
+ continue # exact-match only, e.g. "_sRGB"
74
+ n = _norm(name)
75
+ index[n] = name
76
+ if n.endswith("rgb") and len(n) > 3:
77
+ index.setdefault(n[:-3], name)
78
+ for alias, name in _ALIASES.items():
79
+ index[_norm(alias)] = name
80
+ return index
81
+
82
+
83
+ _INDEX = _build_index()
84
+
85
+
86
+ def builtin_names() -> list[str]:
87
+ """Canonical names of the built-in profiles."""
88
+ return list(_FACTORIES)
89
+
90
+
91
+ def lookup_builtin(name: str) -> str | None:
92
+ """The canonical built-in name for ``name`` (case-insensitive, lenient), or None."""
93
+ if name in _FACTORIES:
94
+ return name
95
+ return _INDEX.get(_norm(name))
96
+
97
+
98
+ def create_builtin(name: str) -> Any:
99
+ """Profile capsule of a canonical built-in name."""
100
+ return _FACTORIES[name]()
101
+
102
+
103
+ def white_point_from_temperature(kelvin: float) -> tuple[float, float, float]:
104
+ """xyY of the CIE daylight locus at a correlated colour temperature (4000-25000 K)."""
105
+ t = float(kelvin)
106
+ if not 4000 <= t <= 25000:
107
+ raise ValueError(f"temperature must be between 4000 and 25000 K for the daylight locus, got {t:g}")
108
+ t2, t3 = t * t, t * t * t
109
+ if t <= 7000:
110
+ x = -4.6070e9 / t3 + 2.9678e6 / t2 + 0.09911e3 / t + 0.244063
111
+ else:
112
+ x = -2.0064e9 / t3 + 1.9018e6 / t2 + 0.24748e3 / t + 0.237040
113
+ y = -3.000 * x * x + 2.870 * x - 0.275
114
+ return (x, y, 1.0)
115
+
116
+
117
+ def resolve_white_point(
118
+ white_point: WhitePoint, degrees: int = 2, temperature: float | None = None
119
+ ) -> tuple[float, float, float] | None:
120
+ """xyY from an illuminant name ("D65"), an (x, y[, Y]) sequence or a temperature in kelvin.
121
+
122
+ Raises
123
+ ------
124
+ ValueError
125
+ For unknown illuminants or observers, listing the valid ones.
126
+ """
127
+ if temperature is not None:
128
+ if white_point is not None:
129
+ raise ValueError("give either white_point or temperature, not both")
130
+ return white_point_from_temperature(temperature)
131
+ if white_point is None:
132
+ return None
133
+ if isinstance(white_point, str):
134
+ if degrees not in WHITE_POINTS:
135
+ raise ValueError(f"degrees must be 2 or 10, got {degrees!r}")
136
+ table = WHITE_POINTS[degrees]
137
+ key = {k.upper(): k for k in table}.get(white_point.upper())
138
+ if key is None:
139
+ raise ValueError(
140
+ f"unknown illuminant {white_point!r} for the {degrees}° observer; known: {', '.join(table)}"
141
+ )
142
+ return tuple(table[key]["xyY"]) # type: ignore[return-value]
143
+ if isinstance(white_point, (int, float)):
144
+ return white_point_from_temperature(white_point)
145
+ values = tuple(float(v) for v in white_point)
146
+ if len(values) == 2:
147
+ values = values + (1.0,)
148
+ if len(values) != 3:
149
+ raise ValueError(f"white_point must be (x, y) or (x, y, Y), got {len(values)} values")
150
+ return values # type: ignore[return-value]
@@ -0,0 +1,18 @@
1
+ from collections.abc import Sequence
2
+ from typing import Any, TypeAlias
3
+
4
+ __all__ = ["builtin_names", "create_builtin", "lookup_builtin", "resolve_white_point"]
5
+
6
+ WhitePoint: TypeAlias = str | float | Sequence[float] | None
7
+
8
+ def builtin_names() -> list[str]: ...
9
+
10
+ def lookup_builtin(name: str) -> str | None: ...
11
+
12
+ def create_builtin(name: str) -> Any: ...
13
+
14
+ def resolve_white_point(
15
+ white_point: WhitePoint,
16
+ degrees: int = 2,
17
+ temperature: float | None = None,
18
+ ) -> tuple[float, float, float] | None: ...