@ai-ecoverse/py-pillow 12.3.0-2

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 (217) hide show
  1. package/LICENSE +30 -0
  2. package/README.md +4 -0
  3. package/lib/python3.14/site-packages/PIL/AvifImagePlugin.py +295 -0
  4. package/lib/python3.14/site-packages/PIL/BdfFontFile.py +124 -0
  5. package/lib/python3.14/site-packages/PIL/BlpImagePlugin.py +498 -0
  6. package/lib/python3.14/site-packages/PIL/BmpImagePlugin.py +514 -0
  7. package/lib/python3.14/site-packages/PIL/BufrStubImagePlugin.py +72 -0
  8. package/lib/python3.14/site-packages/PIL/ContainerIO.py +173 -0
  9. package/lib/python3.14/site-packages/PIL/CurImagePlugin.py +103 -0
  10. package/lib/python3.14/site-packages/PIL/DcxImagePlugin.py +84 -0
  11. package/lib/python3.14/site-packages/PIL/DdsImagePlugin.py +632 -0
  12. package/lib/python3.14/site-packages/PIL/EpsImagePlugin.py +484 -0
  13. package/lib/python3.14/site-packages/PIL/ExifTags.py +384 -0
  14. package/lib/python3.14/site-packages/PIL/FitsImagePlugin.py +153 -0
  15. package/lib/python3.14/site-packages/PIL/FliImagePlugin.py +184 -0
  16. package/lib/python3.14/site-packages/PIL/FontFile.py +160 -0
  17. package/lib/python3.14/site-packages/PIL/FpxImagePlugin.py +262 -0
  18. package/lib/python3.14/site-packages/PIL/FtexImagePlugin.py +115 -0
  19. package/lib/python3.14/site-packages/PIL/GbrImagePlugin.py +103 -0
  20. package/lib/python3.14/site-packages/PIL/GdImageFile.py +104 -0
  21. package/lib/python3.14/site-packages/PIL/GifImagePlugin.py +1223 -0
  22. package/lib/python3.14/site-packages/PIL/GimpGradientFile.py +154 -0
  23. package/lib/python3.14/site-packages/PIL/GimpPaletteFile.py +75 -0
  24. package/lib/python3.14/site-packages/PIL/GribStubImagePlugin.py +72 -0
  25. package/lib/python3.14/site-packages/PIL/Hdf5StubImagePlugin.py +72 -0
  26. package/lib/python3.14/site-packages/PIL/IcnsImagePlugin.py +401 -0
  27. package/lib/python3.14/site-packages/PIL/IcoImagePlugin.py +396 -0
  28. package/lib/python3.14/site-packages/PIL/ImImagePlugin.py +390 -0
  29. package/lib/python3.14/site-packages/PIL/Image.py +4385 -0
  30. package/lib/python3.14/site-packages/PIL/ImageChops.py +311 -0
  31. package/lib/python3.14/site-packages/PIL/ImageCms.py +1078 -0
  32. package/lib/python3.14/site-packages/PIL/ImageColor.py +320 -0
  33. package/lib/python3.14/site-packages/PIL/ImageDraw.py +1002 -0
  34. package/lib/python3.14/site-packages/PIL/ImageDraw2.py +244 -0
  35. package/lib/python3.14/site-packages/PIL/ImageEnhance.py +113 -0
  36. package/lib/python3.14/site-packages/PIL/ImageFile.py +938 -0
  37. package/lib/python3.14/site-packages/PIL/ImageFilter.py +617 -0
  38. package/lib/python3.14/site-packages/PIL/ImageFont.py +1330 -0
  39. package/lib/python3.14/site-packages/PIL/ImageGrab.py +234 -0
  40. package/lib/python3.14/site-packages/PIL/ImageMath.py +314 -0
  41. package/lib/python3.14/site-packages/PIL/ImageMode.py +85 -0
  42. package/lib/python3.14/site-packages/PIL/ImageMorph.py +317 -0
  43. package/lib/python3.14/site-packages/PIL/ImageOps.py +749 -0
  44. package/lib/python3.14/site-packages/PIL/ImagePalette.py +290 -0
  45. package/lib/python3.14/site-packages/PIL/ImagePath.py +20 -0
  46. package/lib/python3.14/site-packages/PIL/ImageQt.py +219 -0
  47. package/lib/python3.14/site-packages/PIL/ImageSequence.py +88 -0
  48. package/lib/python3.14/site-packages/PIL/ImageShow.py +367 -0
  49. package/lib/python3.14/site-packages/PIL/ImageStat.py +167 -0
  50. package/lib/python3.14/site-packages/PIL/ImageText.py +509 -0
  51. package/lib/python3.14/site-packages/PIL/ImageTk.py +266 -0
  52. package/lib/python3.14/site-packages/PIL/ImageTransform.py +136 -0
  53. package/lib/python3.14/site-packages/PIL/ImageWin.py +247 -0
  54. package/lib/python3.14/site-packages/PIL/ImtImagePlugin.py +103 -0
  55. package/lib/python3.14/site-packages/PIL/IptcImagePlugin.py +226 -0
  56. package/lib/python3.14/site-packages/PIL/Jpeg2KImagePlugin.py +466 -0
  57. package/lib/python3.14/site-packages/PIL/JpegImagePlugin.py +889 -0
  58. package/lib/python3.14/site-packages/PIL/JpegPresets.py +242 -0
  59. package/lib/python3.14/site-packages/PIL/McIdasImagePlugin.py +78 -0
  60. package/lib/python3.14/site-packages/PIL/MicImagePlugin.py +103 -0
  61. package/lib/python3.14/site-packages/PIL/MpegImagePlugin.py +84 -0
  62. package/lib/python3.14/site-packages/PIL/MpoImagePlugin.py +203 -0
  63. package/lib/python3.14/site-packages/PIL/MspImagePlugin.py +200 -0
  64. package/lib/python3.14/site-packages/PIL/PSDraw.py +238 -0
  65. package/lib/python3.14/site-packages/PIL/PaletteFile.py +54 -0
  66. package/lib/python3.14/site-packages/PIL/PalmImagePlugin.py +217 -0
  67. package/lib/python3.14/site-packages/PIL/PcdImagePlugin.py +68 -0
  68. package/lib/python3.14/site-packages/PIL/PcfFontFile.py +256 -0
  69. package/lib/python3.14/site-packages/PIL/PcxImagePlugin.py +232 -0
  70. package/lib/python3.14/site-packages/PIL/PdfImagePlugin.py +315 -0
  71. package/lib/python3.14/site-packages/PIL/PdfParser.py +1092 -0
  72. package/lib/python3.14/site-packages/PIL/PixarImagePlugin.py +72 -0
  73. package/lib/python3.14/site-packages/PIL/PngImagePlugin.py +1578 -0
  74. package/lib/python3.14/site-packages/PIL/PpmImagePlugin.py +375 -0
  75. package/lib/python3.14/site-packages/PIL/PsdImagePlugin.py +339 -0
  76. package/lib/python3.14/site-packages/PIL/QoiImagePlugin.py +235 -0
  77. package/lib/python3.14/site-packages/PIL/SgiImagePlugin.py +231 -0
  78. package/lib/python3.14/site-packages/PIL/SpiderImagePlugin.py +332 -0
  79. package/lib/python3.14/site-packages/PIL/SunImagePlugin.py +145 -0
  80. package/lib/python3.14/site-packages/PIL/TarIO.py +61 -0
  81. package/lib/python3.14/site-packages/PIL/TgaImagePlugin.py +284 -0
  82. package/lib/python3.14/site-packages/PIL/TiffImagePlugin.py +2354 -0
  83. package/lib/python3.14/site-packages/PIL/TiffTags.py +566 -0
  84. package/lib/python3.14/site-packages/PIL/WalImageFile.py +129 -0
  85. package/lib/python3.14/site-packages/PIL/WebPImagePlugin.py +322 -0
  86. package/lib/python3.14/site-packages/PIL/WmfImagePlugin.py +183 -0
  87. package/lib/python3.14/site-packages/PIL/XVThumbImagePlugin.py +83 -0
  88. package/lib/python3.14/site-packages/PIL/XbmImagePlugin.py +98 -0
  89. package/lib/python3.14/site-packages/PIL/XpmImagePlugin.py +157 -0
  90. package/lib/python3.14/site-packages/PIL/__init__.py +87 -0
  91. package/lib/python3.14/site-packages/PIL/__main__.py +7 -0
  92. package/lib/python3.14/site-packages/PIL/__pycache__/AvifImagePlugin.cpython-314.pyc +0 -0
  93. package/lib/python3.14/site-packages/PIL/__pycache__/BdfFontFile.cpython-314.pyc +0 -0
  94. package/lib/python3.14/site-packages/PIL/__pycache__/BlpImagePlugin.cpython-314.pyc +0 -0
  95. package/lib/python3.14/site-packages/PIL/__pycache__/BmpImagePlugin.cpython-314.pyc +0 -0
  96. package/lib/python3.14/site-packages/PIL/__pycache__/BufrStubImagePlugin.cpython-314.pyc +0 -0
  97. package/lib/python3.14/site-packages/PIL/__pycache__/ContainerIO.cpython-314.pyc +0 -0
  98. package/lib/python3.14/site-packages/PIL/__pycache__/CurImagePlugin.cpython-314.pyc +0 -0
  99. package/lib/python3.14/site-packages/PIL/__pycache__/DcxImagePlugin.cpython-314.pyc +0 -0
  100. package/lib/python3.14/site-packages/PIL/__pycache__/DdsImagePlugin.cpython-314.pyc +0 -0
  101. package/lib/python3.14/site-packages/PIL/__pycache__/EpsImagePlugin.cpython-314.pyc +0 -0
  102. package/lib/python3.14/site-packages/PIL/__pycache__/ExifTags.cpython-314.pyc +0 -0
  103. package/lib/python3.14/site-packages/PIL/__pycache__/FitsImagePlugin.cpython-314.pyc +0 -0
  104. package/lib/python3.14/site-packages/PIL/__pycache__/FliImagePlugin.cpython-314.pyc +0 -0
  105. package/lib/python3.14/site-packages/PIL/__pycache__/FontFile.cpython-314.pyc +0 -0
  106. package/lib/python3.14/site-packages/PIL/__pycache__/FpxImagePlugin.cpython-314.pyc +0 -0
  107. package/lib/python3.14/site-packages/PIL/__pycache__/FtexImagePlugin.cpython-314.pyc +0 -0
  108. package/lib/python3.14/site-packages/PIL/__pycache__/GbrImagePlugin.cpython-314.pyc +0 -0
  109. package/lib/python3.14/site-packages/PIL/__pycache__/GdImageFile.cpython-314.pyc +0 -0
  110. package/lib/python3.14/site-packages/PIL/__pycache__/GifImagePlugin.cpython-314.pyc +0 -0
  111. package/lib/python3.14/site-packages/PIL/__pycache__/GimpGradientFile.cpython-314.pyc +0 -0
  112. package/lib/python3.14/site-packages/PIL/__pycache__/GimpPaletteFile.cpython-314.pyc +0 -0
  113. package/lib/python3.14/site-packages/PIL/__pycache__/GribStubImagePlugin.cpython-314.pyc +0 -0
  114. package/lib/python3.14/site-packages/PIL/__pycache__/Hdf5StubImagePlugin.cpython-314.pyc +0 -0
  115. package/lib/python3.14/site-packages/PIL/__pycache__/IcnsImagePlugin.cpython-314.pyc +0 -0
  116. package/lib/python3.14/site-packages/PIL/__pycache__/IcoImagePlugin.cpython-314.pyc +0 -0
  117. package/lib/python3.14/site-packages/PIL/__pycache__/ImImagePlugin.cpython-314.pyc +0 -0
  118. package/lib/python3.14/site-packages/PIL/__pycache__/Image.cpython-314.pyc +0 -0
  119. package/lib/python3.14/site-packages/PIL/__pycache__/ImageChops.cpython-314.pyc +0 -0
  120. package/lib/python3.14/site-packages/PIL/__pycache__/ImageCms.cpython-314.pyc +0 -0
  121. package/lib/python3.14/site-packages/PIL/__pycache__/ImageColor.cpython-314.pyc +0 -0
  122. package/lib/python3.14/site-packages/PIL/__pycache__/ImageDraw.cpython-314.pyc +0 -0
  123. package/lib/python3.14/site-packages/PIL/__pycache__/ImageDraw2.cpython-314.pyc +0 -0
  124. package/lib/python3.14/site-packages/PIL/__pycache__/ImageEnhance.cpython-314.pyc +0 -0
  125. package/lib/python3.14/site-packages/PIL/__pycache__/ImageFile.cpython-314.pyc +0 -0
  126. package/lib/python3.14/site-packages/PIL/__pycache__/ImageFilter.cpython-314.pyc +0 -0
  127. package/lib/python3.14/site-packages/PIL/__pycache__/ImageFont.cpython-314.pyc +0 -0
  128. package/lib/python3.14/site-packages/PIL/__pycache__/ImageGrab.cpython-314.pyc +0 -0
  129. package/lib/python3.14/site-packages/PIL/__pycache__/ImageMath.cpython-314.pyc +0 -0
  130. package/lib/python3.14/site-packages/PIL/__pycache__/ImageMode.cpython-314.pyc +0 -0
  131. package/lib/python3.14/site-packages/PIL/__pycache__/ImageMorph.cpython-314.pyc +0 -0
  132. package/lib/python3.14/site-packages/PIL/__pycache__/ImageOps.cpython-314.pyc +0 -0
  133. package/lib/python3.14/site-packages/PIL/__pycache__/ImagePalette.cpython-314.pyc +0 -0
  134. package/lib/python3.14/site-packages/PIL/__pycache__/ImagePath.cpython-314.pyc +0 -0
  135. package/lib/python3.14/site-packages/PIL/__pycache__/ImageQt.cpython-314.pyc +0 -0
  136. package/lib/python3.14/site-packages/PIL/__pycache__/ImageSequence.cpython-314.pyc +0 -0
  137. package/lib/python3.14/site-packages/PIL/__pycache__/ImageShow.cpython-314.pyc +0 -0
  138. package/lib/python3.14/site-packages/PIL/__pycache__/ImageStat.cpython-314.pyc +0 -0
  139. package/lib/python3.14/site-packages/PIL/__pycache__/ImageText.cpython-314.pyc +0 -0
  140. package/lib/python3.14/site-packages/PIL/__pycache__/ImageTk.cpython-314.pyc +0 -0
  141. package/lib/python3.14/site-packages/PIL/__pycache__/ImageTransform.cpython-314.pyc +0 -0
  142. package/lib/python3.14/site-packages/PIL/__pycache__/ImageWin.cpython-314.pyc +0 -0
  143. package/lib/python3.14/site-packages/PIL/__pycache__/ImtImagePlugin.cpython-314.pyc +0 -0
  144. package/lib/python3.14/site-packages/PIL/__pycache__/IptcImagePlugin.cpython-314.pyc +0 -0
  145. package/lib/python3.14/site-packages/PIL/__pycache__/Jpeg2KImagePlugin.cpython-314.pyc +0 -0
  146. package/lib/python3.14/site-packages/PIL/__pycache__/JpegImagePlugin.cpython-314.pyc +0 -0
  147. package/lib/python3.14/site-packages/PIL/__pycache__/JpegPresets.cpython-314.pyc +0 -0
  148. package/lib/python3.14/site-packages/PIL/__pycache__/McIdasImagePlugin.cpython-314.pyc +0 -0
  149. package/lib/python3.14/site-packages/PIL/__pycache__/MicImagePlugin.cpython-314.pyc +0 -0
  150. package/lib/python3.14/site-packages/PIL/__pycache__/MpegImagePlugin.cpython-314.pyc +0 -0
  151. package/lib/python3.14/site-packages/PIL/__pycache__/MpoImagePlugin.cpython-314.pyc +0 -0
  152. package/lib/python3.14/site-packages/PIL/__pycache__/MspImagePlugin.cpython-314.pyc +0 -0
  153. package/lib/python3.14/site-packages/PIL/__pycache__/PSDraw.cpython-314.pyc +0 -0
  154. package/lib/python3.14/site-packages/PIL/__pycache__/PaletteFile.cpython-314.pyc +0 -0
  155. package/lib/python3.14/site-packages/PIL/__pycache__/PalmImagePlugin.cpython-314.pyc +0 -0
  156. package/lib/python3.14/site-packages/PIL/__pycache__/PcdImagePlugin.cpython-314.pyc +0 -0
  157. package/lib/python3.14/site-packages/PIL/__pycache__/PcfFontFile.cpython-314.pyc +0 -0
  158. package/lib/python3.14/site-packages/PIL/__pycache__/PcxImagePlugin.cpython-314.pyc +0 -0
  159. package/lib/python3.14/site-packages/PIL/__pycache__/PdfImagePlugin.cpython-314.pyc +0 -0
  160. package/lib/python3.14/site-packages/PIL/__pycache__/PdfParser.cpython-314.pyc +0 -0
  161. package/lib/python3.14/site-packages/PIL/__pycache__/PixarImagePlugin.cpython-314.pyc +0 -0
  162. package/lib/python3.14/site-packages/PIL/__pycache__/PngImagePlugin.cpython-314.pyc +0 -0
  163. package/lib/python3.14/site-packages/PIL/__pycache__/PpmImagePlugin.cpython-314.pyc +0 -0
  164. package/lib/python3.14/site-packages/PIL/__pycache__/PsdImagePlugin.cpython-314.pyc +0 -0
  165. package/lib/python3.14/site-packages/PIL/__pycache__/QoiImagePlugin.cpython-314.pyc +0 -0
  166. package/lib/python3.14/site-packages/PIL/__pycache__/SgiImagePlugin.cpython-314.pyc +0 -0
  167. package/lib/python3.14/site-packages/PIL/__pycache__/SpiderImagePlugin.cpython-314.pyc +0 -0
  168. package/lib/python3.14/site-packages/PIL/__pycache__/SunImagePlugin.cpython-314.pyc +0 -0
  169. package/lib/python3.14/site-packages/PIL/__pycache__/TarIO.cpython-314.pyc +0 -0
  170. package/lib/python3.14/site-packages/PIL/__pycache__/TgaImagePlugin.cpython-314.pyc +0 -0
  171. package/lib/python3.14/site-packages/PIL/__pycache__/TiffImagePlugin.cpython-314.pyc +0 -0
  172. package/lib/python3.14/site-packages/PIL/__pycache__/TiffTags.cpython-314.pyc +0 -0
  173. package/lib/python3.14/site-packages/PIL/__pycache__/WalImageFile.cpython-314.pyc +0 -0
  174. package/lib/python3.14/site-packages/PIL/__pycache__/WebPImagePlugin.cpython-314.pyc +0 -0
  175. package/lib/python3.14/site-packages/PIL/__pycache__/WmfImagePlugin.cpython-314.pyc +0 -0
  176. package/lib/python3.14/site-packages/PIL/__pycache__/XVThumbImagePlugin.cpython-314.pyc +0 -0
  177. package/lib/python3.14/site-packages/PIL/__pycache__/XbmImagePlugin.cpython-314.pyc +0 -0
  178. package/lib/python3.14/site-packages/PIL/__pycache__/XpmImagePlugin.cpython-314.pyc +0 -0
  179. package/lib/python3.14/site-packages/PIL/__pycache__/__init__.cpython-314.pyc +0 -0
  180. package/lib/python3.14/site-packages/PIL/__pycache__/__main__.cpython-314.pyc +0 -0
  181. package/lib/python3.14/site-packages/PIL/__pycache__/_binary.cpython-314.pyc +0 -0
  182. package/lib/python3.14/site-packages/PIL/__pycache__/_deprecate.cpython-314.pyc +0 -0
  183. package/lib/python3.14/site-packages/PIL/__pycache__/_tkinter_finder.cpython-314.pyc +0 -0
  184. package/lib/python3.14/site-packages/PIL/__pycache__/_typing.cpython-314.pyc +0 -0
  185. package/lib/python3.14/site-packages/PIL/__pycache__/_util.cpython-314.pyc +0 -0
  186. package/lib/python3.14/site-packages/PIL/__pycache__/_version.cpython-314.pyc +0 -0
  187. package/lib/python3.14/site-packages/PIL/__pycache__/features.cpython-314.pyc +0 -0
  188. package/lib/python3.14/site-packages/PIL/__pycache__/report.cpython-314.pyc +0 -0
  189. package/lib/python3.14/site-packages/PIL/_avif.pyi +3 -0
  190. package/lib/python3.14/site-packages/PIL/_binary.py +113 -0
  191. package/lib/python3.14/site-packages/PIL/_deprecate.py +72 -0
  192. package/lib/python3.14/site-packages/PIL/_imaging.cpython-314-wasm32-wasix.so +0 -0
  193. package/lib/python3.14/site-packages/PIL/_imaging.pyi +31 -0
  194. package/lib/python3.14/site-packages/PIL/_imagingcms.pyi +143 -0
  195. package/lib/python3.14/site-packages/PIL/_imagingft.cpython-314-wasm32-wasix.so +0 -0
  196. package/lib/python3.14/site-packages/PIL/_imagingft.pyi +70 -0
  197. package/lib/python3.14/site-packages/PIL/_imagingmath.cpython-314-wasm32-wasix.so +0 -0
  198. package/lib/python3.14/site-packages/PIL/_imagingmath.pyi +3 -0
  199. package/lib/python3.14/site-packages/PIL/_imagingmorph.cpython-314-wasm32-wasix.so +0 -0
  200. package/lib/python3.14/site-packages/PIL/_imagingmorph.pyi +3 -0
  201. package/lib/python3.14/site-packages/PIL/_imagingtk.cpython-314-wasm32-wasix.so +0 -0
  202. package/lib/python3.14/site-packages/PIL/_imagingtk.pyi +3 -0
  203. package/lib/python3.14/site-packages/PIL/_tkinter_finder.py +20 -0
  204. package/lib/python3.14/site-packages/PIL/_typing.py +45 -0
  205. package/lib/python3.14/site-packages/PIL/_util.py +29 -0
  206. package/lib/python3.14/site-packages/PIL/_version.py +4 -0
  207. package/lib/python3.14/site-packages/PIL/_webp.pyi +3 -0
  208. package/lib/python3.14/site-packages/PIL/features.py +343 -0
  209. package/lib/python3.14/site-packages/PIL/py.typed +0 -0
  210. package/lib/python3.14/site-packages/PIL/report.py +5 -0
  211. package/lib/python3.14/site-packages/pillow-12.3.0.dist-info/METADATA +180 -0
  212. package/lib/python3.14/site-packages/pillow-12.3.0.dist-info/RECORD +117 -0
  213. package/lib/python3.14/site-packages/pillow-12.3.0.dist-info/WHEEL +5 -0
  214. package/lib/python3.14/site-packages/pillow-12.3.0.dist-info/licenses/LICENSE +30 -0
  215. package/lib/python3.14/site-packages/pillow-12.3.0.dist-info/top_level.txt +1 -0
  216. package/lib/python3.14/site-packages/pillow-12.3.0.dist-info/zip-safe +1 -0
  217. package/package.json +46 -0
package/LICENSE ADDED
@@ -0,0 +1,30 @@
1
+ The Python Imaging Library (PIL) is
2
+
3
+ Copyright © 1997-2011 by Secret Labs AB
4
+ Copyright © 1995-2011 by Fredrik Lundh and contributors
5
+
6
+ Pillow is the friendly PIL fork. It is
7
+
8
+ Copyright © 2010 by Jeffrey 'Alex' Clark and contributors
9
+
10
+ Like PIL, Pillow is licensed under the open source MIT-CMU License:
11
+
12
+ By obtaining, using, and/or copying this software and/or its associated
13
+ documentation, you agree that you have read, understood, and will comply
14
+ with the following terms and conditions:
15
+
16
+ Permission to use, copy, modify and distribute this software and its
17
+ documentation for any purpose and without fee is hereby granted,
18
+ provided that the above copyright notice appears in all copies, and that
19
+ both that copyright notice and this permission notice appear in supporting
20
+ documentation, and that the name of Secret Labs AB or the author not be
21
+ used in advertising or publicity pertaining to distribution of the software
22
+ without specific, written prior permission.
23
+
24
+ SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
25
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
26
+ IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR ANY SPECIAL,
27
+ INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
28
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
29
+ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
30
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # `@ai-ecoverse/py-pillow`
2
+
3
+ Pillow 12.3.0 for slicc WASIX CPython 3.14 (JPEG/ZLIB/FreeType; PNG via zlib).
4
+ Native codecs left unresolved against `@ai-ecoverse/wasm-libjpeg-turbo`, `wasm-zlib`, `wasm-freetype`.
@@ -0,0 +1,295 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ from io import BytesIO
5
+ from typing import IO
6
+
7
+ from . import ExifTags, Image, ImageFile, ImageSequence
8
+
9
+ try:
10
+ from . import _avif
11
+
12
+ SUPPORTED = True
13
+ except ImportError:
14
+ SUPPORTED = False
15
+
16
+ # Decoder options as module globals, until there is a way to pass parameters
17
+ # to Image.open (see https://github.com/python-pillow/Pillow/issues/569)
18
+ DECODE_CODEC_CHOICE = "auto"
19
+ DEFAULT_MAX_THREADS = 0
20
+
21
+
22
+ def get_codec_version(codec_name: str) -> str | None:
23
+ versions = _avif.codec_versions()
24
+ for version in versions.split(", "):
25
+ if version.split(" [")[0] == codec_name:
26
+ return version.split(":")[-1].split(" ")[0]
27
+ return None
28
+
29
+
30
+ def _accept(prefix: bytes) -> bool | str:
31
+ if prefix[4:8] != b"ftyp":
32
+ return False
33
+ major_brand = prefix[8:12]
34
+ if major_brand in (
35
+ # coding brands
36
+ b"avif",
37
+ b"avis",
38
+ # We accept files with AVIF container brands; we can't yet know if
39
+ # the ftyp box has the correct compatible brands, but if it doesn't
40
+ # then the plugin will raise a SyntaxError which Pillow will catch
41
+ # before moving on to the next plugin that accepts the file.
42
+ #
43
+ # Also, because this file might not actually be an AVIF file, we
44
+ # don't raise an error if AVIF support isn't properly compiled.
45
+ b"mif1",
46
+ b"msf1",
47
+ ):
48
+ if not SUPPORTED:
49
+ return (
50
+ "image file could not be identified because AVIF support not installed"
51
+ )
52
+ return True
53
+ return False
54
+
55
+
56
+ def _get_default_max_threads() -> int:
57
+ if DEFAULT_MAX_THREADS:
58
+ return DEFAULT_MAX_THREADS
59
+ if hasattr(os, "sched_getaffinity"):
60
+ return len(os.sched_getaffinity(0))
61
+ else:
62
+ return os.cpu_count() or 1
63
+
64
+
65
+ class AvifImageFile(ImageFile.ImageFile):
66
+ format = "AVIF"
67
+ format_description = "AVIF image"
68
+ __frame = -1
69
+
70
+ def _open(self) -> None:
71
+ if not SUPPORTED:
72
+ msg = "image file could not be opened because AVIF support not installed"
73
+ raise SyntaxError(msg)
74
+
75
+ if DECODE_CODEC_CHOICE != "auto" and not _avif.decoder_codec_available(
76
+ DECODE_CODEC_CHOICE
77
+ ):
78
+ msg = "Invalid opening codec"
79
+ raise ValueError(msg)
80
+
81
+ assert self.fp is not None
82
+ self._decoder = _avif.AvifDecoder(
83
+ self.fp.read(),
84
+ DECODE_CODEC_CHOICE,
85
+ _get_default_max_threads(),
86
+ )
87
+
88
+ # Get info from decoder
89
+ self._size, self.n_frames, self._mode, icc, exif, exif_orientation, xmp = (
90
+ self._decoder.get_info()
91
+ )
92
+ self.is_animated = self.n_frames > 1
93
+
94
+ if icc:
95
+ self.info["icc_profile"] = icc
96
+ if xmp:
97
+ self.info["xmp"] = xmp
98
+
99
+ if exif_orientation != 1 or exif:
100
+ exif_data = Image.Exif()
101
+ if exif:
102
+ exif_data.load(exif)
103
+ original_orientation = exif_data.get(ExifTags.Base.Orientation, 1)
104
+ else:
105
+ original_orientation = 1
106
+ if exif_orientation != original_orientation:
107
+ exif_data[ExifTags.Base.Orientation] = exif_orientation
108
+ exif = exif_data.tobytes()
109
+ if exif:
110
+ self.info["exif"] = exif
111
+ self.seek(0)
112
+
113
+ def seek(self, frame: int) -> None:
114
+ if not self._seek_check(frame):
115
+ return
116
+
117
+ # Set tile
118
+ self.__frame = frame
119
+ self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 0, self.mode)]
120
+
121
+ def load(self) -> Image.core.PixelAccess | None:
122
+ if self.tile:
123
+ # We need to load the image data for this frame
124
+ data, timescale, pts_in_timescales, duration_in_timescales = (
125
+ self._decoder.get_frame(self.__frame)
126
+ )
127
+ self.info["timestamp"] = round(1000 * (pts_in_timescales / timescale))
128
+ self.info["duration"] = round(1000 * (duration_in_timescales / timescale))
129
+
130
+ if self.fp and self._exclusive_fp:
131
+ self.fp.close()
132
+ self.fp = BytesIO(data)
133
+
134
+ return super().load()
135
+
136
+ def load_seek(self, pos: int) -> None:
137
+ pass
138
+
139
+ def tell(self) -> int:
140
+ return self.__frame
141
+
142
+
143
+ def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
144
+ _save(im, fp, filename, save_all=True)
145
+
146
+
147
+ def _save(
148
+ im: Image.Image, fp: IO[bytes], filename: str | bytes, save_all: bool = False
149
+ ) -> None:
150
+ info = im.encoderinfo.copy()
151
+ if save_all:
152
+ append_images = list(info.get("append_images", []))
153
+ else:
154
+ append_images = []
155
+
156
+ grayscale_modes = {"1", "L", "I", "I;16", "I;16L", "I;16B", "I;16N", "F"}
157
+ grayscale = all(
158
+ frame.mode in grayscale_modes
159
+ for ims in [im] + append_images
160
+ for frame in ImageSequence.Iterator(ims)
161
+ )
162
+
163
+ quality = info.get("quality", 75)
164
+ if not isinstance(quality, int) or quality < 0 or quality > 100:
165
+ msg = "Invalid quality setting"
166
+ raise ValueError(msg)
167
+
168
+ duration = info.get("duration", 0)
169
+ subsampling = info.get("subsampling", "4:0:0" if grayscale else "4:2:0")
170
+ speed = info.get("speed", 6)
171
+ max_threads = info.get("max_threads", _get_default_max_threads())
172
+ codec = info.get("codec", "auto")
173
+ if codec != "auto" and not _avif.encoder_codec_available(codec):
174
+ msg = "Invalid saving codec"
175
+ raise ValueError(msg)
176
+ range_ = info.get("range", "full")
177
+ tile_rows_log2 = info.get("tile_rows", 0)
178
+ tile_cols_log2 = info.get("tile_cols", 0)
179
+ alpha_premultiplied = bool(info.get("alpha_premultiplied", False))
180
+ autotiling = bool(info.get("autotiling", tile_rows_log2 == tile_cols_log2 == 0))
181
+
182
+ icc_profile = info.get("icc_profile", im.info.get("icc_profile"))
183
+ exif_orientation = 1
184
+ if exif := info.get("exif"):
185
+ if isinstance(exif, Image.Exif):
186
+ exif_data = exif
187
+ else:
188
+ exif_data = Image.Exif()
189
+ exif_data.load(exif)
190
+ if ExifTags.Base.Orientation in exif_data:
191
+ exif_orientation = exif_data.pop(ExifTags.Base.Orientation)
192
+ exif = exif_data.tobytes() if exif_data else b""
193
+ elif isinstance(exif, Image.Exif):
194
+ exif = exif_data.tobytes()
195
+
196
+ xmp = info.get("xmp")
197
+
198
+ if isinstance(xmp, str):
199
+ xmp = xmp.encode("utf-8")
200
+
201
+ advanced = info.get("advanced")
202
+ if advanced is not None:
203
+ if isinstance(advanced, dict):
204
+ advanced = advanced.items()
205
+ try:
206
+ advanced = tuple(advanced)
207
+ except TypeError:
208
+ invalid = True
209
+ else:
210
+ invalid = any(not isinstance(v, tuple) or len(v) != 2 for v in advanced)
211
+ if invalid:
212
+ msg = (
213
+ "advanced codec options must be a dict of key-value string "
214
+ "pairs or a series of key-value two-tuples"
215
+ )
216
+ raise ValueError(msg)
217
+
218
+ # Setup the AVIF encoder
219
+ enc = _avif.AvifEncoder(
220
+ im.size,
221
+ subsampling,
222
+ quality,
223
+ speed,
224
+ max_threads,
225
+ codec,
226
+ range_,
227
+ tile_rows_log2,
228
+ tile_cols_log2,
229
+ alpha_premultiplied,
230
+ autotiling,
231
+ icc_profile or b"",
232
+ exif or b"",
233
+ exif_orientation,
234
+ xmp or b"",
235
+ advanced,
236
+ )
237
+
238
+ # Add each frame
239
+ frame_idx = 0
240
+ frame_duration = 0
241
+ cur_idx = im.tell()
242
+ is_single_frame = not append_images and not getattr(im, "is_animated", False)
243
+ try:
244
+ for ims in [im] + append_images:
245
+ for frame in ImageSequence.Iterator(ims):
246
+ # Make sure image mode is supported
247
+ rawmode = frame.mode
248
+ if ims.mode not in {"L", "RGB", "RGBA"}:
249
+ if ims.has_transparency_data:
250
+ rawmode = "RGBA"
251
+ elif ims.mode in grayscale_modes:
252
+ rawmode = "L"
253
+ else:
254
+ rawmode = "RGB"
255
+ frame = frame.convert(rawmode)
256
+
257
+ # Update frame duration
258
+ if isinstance(duration, (list, tuple)):
259
+ frame_duration = duration[frame_idx]
260
+ else:
261
+ frame_duration = duration
262
+
263
+ # Append the frame to the animation encoder
264
+ enc.add(
265
+ frame.tobytes("raw", rawmode),
266
+ frame_duration,
267
+ frame.size,
268
+ rawmode,
269
+ is_single_frame,
270
+ )
271
+
272
+ # Update frame index
273
+ frame_idx += 1
274
+
275
+ if not save_all:
276
+ break
277
+
278
+ finally:
279
+ im.seek(cur_idx)
280
+
281
+ # Get the final output from the encoder
282
+ data = enc.finish()
283
+ if data is None:
284
+ msg = "cannot write file as AVIF (encoder returned None)"
285
+ raise OSError(msg)
286
+
287
+ fp.write(data)
288
+
289
+
290
+ Image.register_open(AvifImageFile.format, AvifImageFile, _accept)
291
+ if SUPPORTED:
292
+ Image.register_save(AvifImageFile.format, _save)
293
+ Image.register_save_all(AvifImageFile.format, _save_all)
294
+ Image.register_extensions(AvifImageFile.format, [".avif", ".avifs"])
295
+ Image.register_mime(AvifImageFile.format, "image/avif")
@@ -0,0 +1,124 @@
1
+ #
2
+ # The Python Imaging Library
3
+ # $Id$
4
+ #
5
+ # bitmap distribution font (bdf) file parser
6
+ #
7
+ # history:
8
+ # 1996-05-16 fl created (as bdf2pil)
9
+ # 1997-08-25 fl converted to FontFile driver
10
+ # 2001-05-25 fl removed bogus __init__ call
11
+ # 2002-11-20 fl robustification (from Kevin Cazabon, Dmitry Vasiliev)
12
+ # 2003-04-22 fl more robustification (from Graham Dumpleton)
13
+ #
14
+ # Copyright (c) 1997-2003 by Secret Labs AB.
15
+ # Copyright (c) 1997-2003 by Fredrik Lundh.
16
+ #
17
+ # See the README file for information on usage and redistribution.
18
+ #
19
+
20
+ """
21
+ Parse X Bitmap Distribution Format (BDF)
22
+ """
23
+
24
+ from __future__ import annotations
25
+
26
+ from typing import BinaryIO
27
+
28
+ from . import FontFile, Image
29
+
30
+
31
+ def bdf_char(
32
+ f: BinaryIO,
33
+ ) -> (
34
+ tuple[
35
+ str,
36
+ int,
37
+ tuple[tuple[int, int], tuple[int, int, int, int], tuple[int, int, int, int]],
38
+ Image.Image,
39
+ ]
40
+ | None
41
+ ):
42
+ # skip to STARTCHAR
43
+ while True:
44
+ s = f.readline()
45
+ if not s:
46
+ return None
47
+ if s.startswith(b"STARTCHAR"):
48
+ break
49
+ id = s[9:].strip().decode("ascii")
50
+
51
+ # load symbol properties
52
+ props = {}
53
+ while True:
54
+ s = f.readline()
55
+ if not s or s.startswith(b"BITMAP"):
56
+ break
57
+ i = s.find(b" ")
58
+ props[s[:i].decode("ascii")] = s[i + 1 : -1].decode("ascii")
59
+
60
+ # load bitmap
61
+ bitmap = bytearray()
62
+ while True:
63
+ s = f.readline()
64
+ if not s or s.startswith(b"ENDCHAR"):
65
+ break
66
+ bitmap += s[:-1]
67
+
68
+ # The word BBX
69
+ # followed by the width in x (BBw), height in y (BBh),
70
+ # and x and y displacement (BBxoff0, BByoff0)
71
+ # of the lower left corner from the origin of the character.
72
+ width, height, x_disp, y_disp = (int(p) for p in props["BBX"].split())
73
+ Image._decompression_bomb_check((width, height))
74
+
75
+ # The word DWIDTH
76
+ # followed by the width in x and y of the character in device pixels.
77
+ dwx, dwy = (int(p) for p in props["DWIDTH"].split())
78
+
79
+ bbox = (
80
+ (dwx, dwy),
81
+ (x_disp, -y_disp - height, width + x_disp, -y_disp),
82
+ (0, 0, width, height),
83
+ )
84
+
85
+ try:
86
+ im = Image.frombytes("1", (width, height), bitmap, "hex", "1")
87
+ except ValueError:
88
+ # deal with zero-width characters
89
+ im = Image.new("1", (width, height))
90
+
91
+ return id, int(props["ENCODING"]), bbox, im
92
+
93
+
94
+ class BdfFontFile(FontFile.FontFile):
95
+ """Font file plugin for the X11 BDF format."""
96
+
97
+ def __init__(self, fp: BinaryIO) -> None:
98
+ super().__init__()
99
+
100
+ s = fp.readline()
101
+ if not s.startswith(b"STARTFONT 2.1"):
102
+ msg = "not a valid BDF file"
103
+ raise SyntaxError(msg)
104
+
105
+ props = {}
106
+ comments = []
107
+
108
+ while True:
109
+ s = fp.readline()
110
+ if not s or s.startswith(b"ENDPROPERTIES"):
111
+ break
112
+ i = s.find(b" ")
113
+ props[s[:i].decode("ascii")] = s[i + 1 : -1].decode("ascii")
114
+ if s[:i] in [b"COMMENT", b"COPYRIGHT"]:
115
+ if s.find(b"LogicalFontDescription") < 0:
116
+ comments.append(s[i + 1 : -1].decode("ascii"))
117
+
118
+ while True:
119
+ c = bdf_char(fp)
120
+ if not c:
121
+ break
122
+ id, ch, (xy, dst, src), im = c
123
+ if 0 <= ch < len(self.glyph):
124
+ self.glyph[ch] = xy, dst, src, im