Initial commit

This commit is contained in:
2024-08-27 20:33:44 +02:00
commit 1f1832267d
14794 changed files with 1599592 additions and 0 deletions

View File

@@ -0,0 +1 @@
pip

View File

@@ -0,0 +1,27 @@
Copyright (c) 2014 Torchbox Ltd and individual contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of Torchbox nor the names of its contributors may be used
to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,138 @@
Metadata-Version: 2.1
Name: Willow
Version: 1.8.0
Summary: A Python image library that sits on top of Pillow, Wand and OpenCV
Keywords: Imaging
Author-email: Karl Hobley <karl@kaed.uk>
Maintainer-email: Wagtail Core team <hello@wagtail.org>
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Classifier: Development Status :: 5 - Production/Stable
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: filetype>=1.0.10,!=1.1.0
Requires-Dist: defusedxml>=0.7,<1.0
Requires-Dist: Sphinx>=7.0 ; extra == "docs"
Requires-Dist: sphinx-wagtail-theme>=6.1.1,<7.0 ; extra == "docs"
Requires-Dist: sphinxcontrib-spelling>=8.0,<9.0 ; extra == "docs"
Requires-Dist: sphinx_copybutton>=0.5 ; extra == "docs"
Requires-Dist: pillow-heif>=0.10.0,<1.0.0 ; extra == "heif" and ( python_version < '3.12')
Requires-Dist: pillow-heif>=0.13.0,<1.0.0 ; extra == "heif" and ( python_version >= '3.12')
Requires-Dist: Pillow>=9.1.0,<11.0.0 ; extra == "pillow"
Requires-Dist: willow[pillow,wand,heif] ; extra == "testing"
Requires-Dist: coverage[toml]>=7.2.7,<8.0 ; extra == "testing"
Requires-Dist: pre-commit>=3.4.0 ; extra == "testing"
Requires-Dist: Wand>=0.6,<1.0 ; extra == "wand"
Project-URL: Changelog, https://github.com/wagtail/Willow/blob/main/CHANGELOG.txt
Project-URL: Documentation, https://willow.wagtail.org/
Project-URL: Source, https://github.com/wagtail/Willow
Provides-Extra: docs
Provides-Extra: heif
Provides-Extra: pillow
Provides-Extra: testing
Provides-Extra: wand
# [Willow image library](https://pypi.org/project/Willow/)
[![PyPI](https://img.shields.io/pypi/v/Willow.svg)](https://pypi.org/project/Willow/)
[![PyPI downloads](https://img.shields.io/pypi/dm/Willow.svg)](https://pypi.org/project/Willow/)
[![Build Status](https://github.com/torchbox/Willow/workflows/CI/badge.svg)](https://github.com/wagtail/Willow/actions)
A wrapper that combines the functionality of multiple Python image libraries into one API.
[Documentation](https://willow.readthedocs.io/en/latest/index.html)
## Overview
Willow is a simple image library that combines the APIs of [Pillow](https://pillow.readthedocs.io/), [Wand](https://docs.wand-py.org) and [OpenCV](https://opencv.org/).
It converts the image between the libraries when necessary.
Willow currently has basic resize and crop operations, face and feature detection and animated GIF support.
New operations and library integrations can also be [easily implemented](https://willow.readthedocs.org/en/latest/guide/extend.html).
The library is written in pure Python and supports versions 3.8 3.9, 3.10, 3.11 and 3.12.
## Examples
### Resizing an image
```python
from willow.image import Image
f = open('test.png', 'rb')
img = Image.open(f)
# Resize the image to 100x100 pixels
img = img.resize((100, 100))
# Save it
with open('test_thumbnail.png', 'wb') as out:
img.save_as_png(out)
```
This will open the image file with Pillow or Wand (if Pillow is unavailable).
It will then resize it to 100x100 pixels and save it back out as a PNG file.
### Detecting faces
```python
from willow.image import Image
f = open('photo.png', 'rb')
img = Image.open(f)
# Find faces
faces = img.detect_faces()
```
Like above, the image file will be loaded with either Pillow or Wand.
As neither Pillow nor Wand support detecting faces, Willow would automatically convert the image to OpenCV and use that to perform the detection.
## Available operations
[Documentation](https://willow.readthedocs.org/en/latest/reference.html#builtin-operations)
| Operation | Pillow | Wand | OpenCV |
| ------------------------------------------------ | ------ | ---- | ------ |
| `get_size()` | ✓ | ✓ | ✓ |
| `get_frame_count()` | ✓\*\* | ✓ | ✓\*\* |
| `resize(size)` | ✓ | ✓ | |
| `crop(rect)` | ✓ | ✓ | |
| `rotate(angle)` | ✓ | ✓ | |
| `set_background_color_rgb(color)` | ✓ | ✓ | |
| `transform_colorspace_to_srgb(rendering_intent)` | ✓ | | |
| `auto_orient()` | ✓ | ✓ | |
| `save_as_jpeg(file, quality)` | ✓ | ✓ | |
| `save_as_png(file)` | ✓ | ✓ | |
| `save_as_gif(file)` | ✓ | ✓ | |
| `save_as_webp(file, quality)` | ✓ | ✓ | |
| `save_as_heif(file, quality, lossless)` | ✓⁺ | | |
| `save_as_avif(file, quality, lossless)` | ✓⁺ | ✓⁺ | |
| `save_as_ico(file)` | ✓ | ✓ | |
| `has_alpha()` | ✓ | ✓ | ✓\* |
| `has_animation()` | ✓\* | ✓ | ✓\* |
| `get_pillow_image()` | ✓ | | |
| `get_wand_image()` | | ✓ | |
| `detect_features()` | | | ✓ |
| `detect_faces(cascade_filename)` | | | ✓ |
\* Always returns `False`
\** Always returns `1`
⁺ Requires the [pillow-heif](https://pypi.org/project/pillow-heif/) library

View File

@@ -0,0 +1,40 @@
willow-1.8.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
willow-1.8.0.dist-info/LICENSE,sha256=M9rvOV0s_XioAXZsMe2HsDd-REuJZUD9EMB5mBcshn0,1545
willow-1.8.0.dist-info/METADATA,sha256=GwvP6xTYzmBpvaibv0XlgrRCbWG-nXcTtbGU4HShYBk,6134
willow-1.8.0.dist-info/RECORD,,
willow-1.8.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
willow/__init__.py,sha256=yRfTgiBooGxU8fMOJc7OdWJMKK_fck57IHaybM_24b0,1775
willow/__pycache__/__init__.cpython-310.pyc,,
willow/__pycache__/image.cpython-310.pyc,,
willow/__pycache__/registry.cpython-310.pyc,,
willow/__pycache__/svg.cpython-310.pyc,,
willow/data/cascades/haarcascade_frontalface_alt2.xml,sha256=8Uz14yH52bYYboHjB_MJ--jvwDWY3b8MpAcPB5T_wwo,837462
willow/image.py,sha256=5r32VKi1bFU61JPAklyY4k97lfrO5Nrf_9XVAjrM4R8,9395
willow/optimizers/__init__.py,sha256=zDfLp8jvJM7au36R44ARLtzHvlyzDrTF0weHmQGzwZ8,219
willow/optimizers/__pycache__/__init__.cpython-310.pyc,,
willow/optimizers/__pycache__/base.cpython-310.pyc,,
willow/optimizers/__pycache__/cwebp.cpython-310.pyc,,
willow/optimizers/__pycache__/gifsicle.cpython-310.pyc,,
willow/optimizers/__pycache__/jpegoptim.cpython-310.pyc,,
willow/optimizers/__pycache__/optipng.cpython-310.pyc,,
willow/optimizers/__pycache__/pngquant.cpython-310.pyc,,
willow/optimizers/base.py,sha256=Bz5_dSxmltKfhLbkB-7oyRdBQ1AUW5aslX04aVuFO3Y,1615
willow/optimizers/cwebp.py,sha256=ldFc4FsAo3dVul-axG568IG8sNEdX2cWg-tDcq-7Plc,947
willow/optimizers/gifsicle.py,sha256=Rcji87w-fDMyC6Y2aAgyvOnHR1fPoyQzl655_-fN4vA,508
willow/optimizers/jpegoptim.py,sha256=8Krm8DJuVbiDQcsY1pyT-hweLXsqbzT3H-w0TZi9Md4,600
willow/optimizers/optipng.py,sha256=1SD_UQUVX09-40PYSxguO5KAD3_t1vdT8QZpJ1X6SEk,535
willow/optimizers/pngquant.py,sha256=Pgb1bsj9otYBCMuDwWmsXPvUJGy7q5Ws3n5_o6_mHKw,648
willow/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
willow/plugins/__pycache__/__init__.cpython-310.pyc,,
willow/plugins/__pycache__/opencv.cpython-310.pyc,,
willow/plugins/__pycache__/pillow.cpython-310.pyc,,
willow/plugins/__pycache__/wand.cpython-310.pyc,,
willow/plugins/opencv.py,sha256=q8OWRQeBhJlribqys6nFCVtB6s8_TQbgvtmm9ulA0fE,3787
willow/plugins/pillow.py,sha256=Rz9y2sKggfnYMdO4PmLslEIPrYVsgg1diNu3dt0o-hs,17507
willow/plugins/wand.py,sha256=hMY4E-RLTJKfnXysL-yo72KYtGK_sgfYRzisQhiild8,10333
willow/registry.py,sha256=onvPUMrZFGDL2ncWY_Urdgxp86Mmu6ypQYI3DmYKALk,15219
willow/svg.py,sha256=UxZWTb58cf_S2iR6CChx7Y_g83zyPunnWcb8UYZAxXI,11884
willow/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
willow/utils/__pycache__/__init__.cpython-310.pyc,,
willow/utils/__pycache__/deprecation.cpython-310.pyc,,
willow/utils/deprecation.py,sha256=oL7Sgxd4XoHRX8_UxiukuzdYC8cuxrKpfpxeMARsrs8,61

View File

@@ -0,0 +1,4 @@
Wheel-Version: 1.0
Generator: flit 3.9.0
Root-Is-Purelib: true
Tag: py3-none-any