diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-05 03:57:59 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 03:57:59 +0000 |
commit | 42766ba3b2783af79fab7ecf6483b225bc8671d0 (patch) | |
tree | 87744a7a57d28d08f645c8dbffbe031ca2ae4d2e | |
parent | fa229207c230136b77506f757756c32ad7668c96 (diff) |
automatic import of python-pillow-heifopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-pillow-heif.spec | 500 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 502 insertions, 0 deletions
@@ -0,0 +1 @@ +/pillow_heif-0.11.0.tar.gz diff --git a/python-pillow-heif.spec b/python-pillow-heif.spec new file mode 100644 index 0000000..d2f6ce7 --- /dev/null +++ b/python-pillow-heif.spec @@ -0,0 +1,500 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pillow-heif +Version: 0.11.0 +Release: 1 +Summary: Python interface for libheif library +License: Apache License 2.0 +URL: https://github.com/bigcat88/pillow_heif +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/92/e7/bd9abe4068f869296e198104928fdefe04b51d0cc6ef9cf0fcede5a9595c/pillow_heif-0.11.0.tar.gz + +Requires: python3-pillow +Requires: python3-pytest +Requires: python3-defusedxml +Requires: python3-packaging +Requires: python3-numpy +Requires: python3-pympler +Requires: python3-opencv-python +Requires: python3-pre-commit +Requires: python3-pylint +Requires: python3-coverage +Requires: python3-sphinx +Requires: python3-sphinx-issues +Requires: python3-sphinx-rtd-theme +Requires: python3-pytest +Requires: python3-defusedxml +Requires: python3-packaging +Requires: python3-numpy +Requires: python3-pympler +Requires: python3-pytest +Requires: python3-defusedxml +Requires: python3-packaging + +%description +# pillow-heif + +[](https://github.com/bigcat88/pillow_heif/actions/workflows/analysis-coverage.yml) +[](https://github.com/andrey18106/pillow_heif/actions/workflows/nightly-src-build.yml) +[](https://github.com/bigcat88/pillow_heif/actions/workflows/test-wheels.yml) +[](https://pillow-heif.readthedocs.io/en/latest/?badge=latest) +[](https://codecov.io/gh/bigcat88/pillow_heif) + + + + +[](https://pepy.tech/project/pillow-heif) +[](https://pepy.tech/project/pillow-heif) + + + + + + + +Python bindings to [libheif](https://github.com/strukturag/libheif) for working with HEIF images and plugin for Pillow. + +Features: + * Decoding of `8`, `10`, `12` bit HEIC and AVIF files. + * Encoding of `8`, `10`, `12` bit HEIC and AVIF files. + * `EXIF`, `XMP`, `IPTC` read & write support. + * Support of multiple images in one file and a `PrimaryImage` attribute. + * Adding & removing `thumbnails`. + * Adding HEIF support to Pillow in one line of code as a plugin. + +Note: Here is a light version [pi-heif](https://pypi.org/project/pi-heif/) of this project without encoding capabilities. + +### Install +```console +python3 -m pip install -U pip +python3 -m pip install pillow-heif +``` + +### Example of use as a Pillow plugin +```python3 +from PIL import Image +from pillow_heif import register_heif_opener + +register_heif_opener() + +im = Image.open("image.heic") # do whatever need with a Pillow image +im = im.rotate(13) +im.save(f"rotated_image.heic", quality=90) +``` + +### 16 bit PNG to 10 bit HEIF using OpenCV +```python3 +import cv2 +import pillow_heif + +cv_img = cv2.imread("16bit_with_alpha.png", cv2.IMREAD_UNCHANGED) +heif_file = pillow_heif.from_bytes( + mode="BGRA;16", + size=(cv_img.shape[1], cv_img.shape[0]), + data=bytes(cv_img) +) +heif_file.save("RGBA_10bit.heic", quality=-1) +``` + +### 8/10/12 bit HEIF to 8/16 bit PNG using OpenCV +```python3 +import numpy as np +import cv2 +import pillow_heif + +heif_file = pillow_heif.open_heif("image.heic", convert_hdr_to_8bit=False, bgr_mode=True) +np_array = np.asarray(heif_file) +cv2.imwrite("image.png", np_array) +``` + +### Accessing decoded image data +```python3 +import pillow_heif + +if pillow_heif.is_supported("image.heic"): + heif_file = pillow_heif.open_heif("image.heic", convert_hdr_to_8bit=False) + print("image size:", heif_file.size) + print("image mode:", heif_file.mode) + print("image data length:", len(heif_file.data)) + print("image data stride:", heif_file.stride) +``` + +### Get decoded image data as a Numpy array +```python3 +import numpy as np +import pillow_heif + +if pillow_heif.is_supported("input.heic"): + heif_file = pillow_heif.open_heif("input.heic") + np_array = np.asarray(heif_file) +``` + +### AVIF support + +Working with the `AVIF` files as the same as with the `HEIC` files. Just use a separate function to register plugin: +```python3 +import pillow_heif + +pillow_heif.register_avif_opener() +``` + +### More Information + +- [Documentation](https://pillow-heif.readthedocs.io/) + - [Installation](https://pillow-heif.readthedocs.io/en/latest/installation.html) + - [Pillow plugin](https://pillow-heif.readthedocs.io/en/latest/pillow-plugin.html) + - [Using HeifFile](https://pillow-heif.readthedocs.io/en/latest/heif-file.html) + - [Image modes](https://pillow-heif.readthedocs.io/en/latest/image-modes.html) + - [Options](https://pillow-heif.readthedocs.io/en/latest/options.html) +- [Examples](https://github.com/bigcat88/pillow_heif/tree/master/examples) +- [Contribute](https://github.com/bigcat88/pillow_heif/blob/master/.github/CONTRIBUTING.md) + - [Discussions](https://github.com/bigcat88/pillow_heif/discussions) + - [Issues](https://github.com/bigcat88/pillow_heif/issues) +- [Changelog](https://github.com/bigcat88/pillow_heif/blob/master/CHANGELOG.md) + +### Wheels + +| **_Wheels table_** | macOS<br/>Intel | macOS<br/>Silicon | Windows<br/>64bit | musllinux* | manylinux* | +|--------------------|:---------------:|:-----------------:|:-----------------:|:----------:|:----------:| +| CPython 3.7 | ✅ | N/A | ✅ | N/A | ✅ | +| CPython 3.8 | ✅ | ✅ | ✅ | ✅ | ✅ | +| CPython 3.9 | ✅ | ✅ | ✅ | ✅ | ✅ | +| CPython 3.10 | ✅ | ✅ | ✅ | ✅ | ✅ | +| CPython 3.11 | ✅ | ✅ | ✅ | ✅ | ✅ | +| PyPy 3.8 v7.3 | ✅ | N/A | ✅ | N/A | ✅ | +| PyPy 3.9 v7.3 | ✅ | N/A | ✅ | N/A | ✅ | + +* **i686**, **x86_64**, **aarch64** wheels. + +`ARMv7l`, `PyPy` 32-bit wheels are published only for [pi-heif](https://pypi.org/project/pi-heif/) from `0.10.0` version. + + +%package -n python3-pillow-heif +Summary: Python interface for libheif library +Provides: python-pillow-heif +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +BuildRequires: python3-cffi +BuildRequires: gcc +BuildRequires: gdb +%description -n python3-pillow-heif +# pillow-heif + +[](https://github.com/bigcat88/pillow_heif/actions/workflows/analysis-coverage.yml) +[](https://github.com/andrey18106/pillow_heif/actions/workflows/nightly-src-build.yml) +[](https://github.com/bigcat88/pillow_heif/actions/workflows/test-wheels.yml) +[](https://pillow-heif.readthedocs.io/en/latest/?badge=latest) +[](https://codecov.io/gh/bigcat88/pillow_heif) + + + + +[](https://pepy.tech/project/pillow-heif) +[](https://pepy.tech/project/pillow-heif) + + + + + + + +Python bindings to [libheif](https://github.com/strukturag/libheif) for working with HEIF images and plugin for Pillow. + +Features: + * Decoding of `8`, `10`, `12` bit HEIC and AVIF files. + * Encoding of `8`, `10`, `12` bit HEIC and AVIF files. + * `EXIF`, `XMP`, `IPTC` read & write support. + * Support of multiple images in one file and a `PrimaryImage` attribute. + * Adding & removing `thumbnails`. + * Adding HEIF support to Pillow in one line of code as a plugin. + +Note: Here is a light version [pi-heif](https://pypi.org/project/pi-heif/) of this project without encoding capabilities. + +### Install +```console +python3 -m pip install -U pip +python3 -m pip install pillow-heif +``` + +### Example of use as a Pillow plugin +```python3 +from PIL import Image +from pillow_heif import register_heif_opener + +register_heif_opener() + +im = Image.open("image.heic") # do whatever need with a Pillow image +im = im.rotate(13) +im.save(f"rotated_image.heic", quality=90) +``` + +### 16 bit PNG to 10 bit HEIF using OpenCV +```python3 +import cv2 +import pillow_heif + +cv_img = cv2.imread("16bit_with_alpha.png", cv2.IMREAD_UNCHANGED) +heif_file = pillow_heif.from_bytes( + mode="BGRA;16", + size=(cv_img.shape[1], cv_img.shape[0]), + data=bytes(cv_img) +) +heif_file.save("RGBA_10bit.heic", quality=-1) +``` + +### 8/10/12 bit HEIF to 8/16 bit PNG using OpenCV +```python3 +import numpy as np +import cv2 +import pillow_heif + +heif_file = pillow_heif.open_heif("image.heic", convert_hdr_to_8bit=False, bgr_mode=True) +np_array = np.asarray(heif_file) +cv2.imwrite("image.png", np_array) +``` + +### Accessing decoded image data +```python3 +import pillow_heif + +if pillow_heif.is_supported("image.heic"): + heif_file = pillow_heif.open_heif("image.heic", convert_hdr_to_8bit=False) + print("image size:", heif_file.size) + print("image mode:", heif_file.mode) + print("image data length:", len(heif_file.data)) + print("image data stride:", heif_file.stride) +``` + +### Get decoded image data as a Numpy array +```python3 +import numpy as np +import pillow_heif + +if pillow_heif.is_supported("input.heic"): + heif_file = pillow_heif.open_heif("input.heic") + np_array = np.asarray(heif_file) +``` + +### AVIF support + +Working with the `AVIF` files as the same as with the `HEIC` files. Just use a separate function to register plugin: +```python3 +import pillow_heif + +pillow_heif.register_avif_opener() +``` + +### More Information + +- [Documentation](https://pillow-heif.readthedocs.io/) + - [Installation](https://pillow-heif.readthedocs.io/en/latest/installation.html) + - [Pillow plugin](https://pillow-heif.readthedocs.io/en/latest/pillow-plugin.html) + - [Using HeifFile](https://pillow-heif.readthedocs.io/en/latest/heif-file.html) + - [Image modes](https://pillow-heif.readthedocs.io/en/latest/image-modes.html) + - [Options](https://pillow-heif.readthedocs.io/en/latest/options.html) +- [Examples](https://github.com/bigcat88/pillow_heif/tree/master/examples) +- [Contribute](https://github.com/bigcat88/pillow_heif/blob/master/.github/CONTRIBUTING.md) + - [Discussions](https://github.com/bigcat88/pillow_heif/discussions) + - [Issues](https://github.com/bigcat88/pillow_heif/issues) +- [Changelog](https://github.com/bigcat88/pillow_heif/blob/master/CHANGELOG.md) + +### Wheels + +| **_Wheels table_** | macOS<br/>Intel | macOS<br/>Silicon | Windows<br/>64bit | musllinux* | manylinux* | +|--------------------|:---------------:|:-----------------:|:-----------------:|:----------:|:----------:| +| CPython 3.7 | ✅ | N/A | ✅ | N/A | ✅ | +| CPython 3.8 | ✅ | ✅ | ✅ | ✅ | ✅ | +| CPython 3.9 | ✅ | ✅ | ✅ | ✅ | ✅ | +| CPython 3.10 | ✅ | ✅ | ✅ | ✅ | ✅ | +| CPython 3.11 | ✅ | ✅ | ✅ | ✅ | ✅ | +| PyPy 3.8 v7.3 | ✅ | N/A | ✅ | N/A | ✅ | +| PyPy 3.9 v7.3 | ✅ | N/A | ✅ | N/A | ✅ | + +* **i686**, **x86_64**, **aarch64** wheels. + +`ARMv7l`, `PyPy` 32-bit wheels are published only for [pi-heif](https://pypi.org/project/pi-heif/) from `0.10.0` version. + + +%package help +Summary: Development documents and examples for pillow-heif +Provides: python3-pillow-heif-doc +%description help +# pillow-heif + +[](https://github.com/bigcat88/pillow_heif/actions/workflows/analysis-coverage.yml) +[](https://github.com/andrey18106/pillow_heif/actions/workflows/nightly-src-build.yml) +[](https://github.com/bigcat88/pillow_heif/actions/workflows/test-wheels.yml) +[](https://pillow-heif.readthedocs.io/en/latest/?badge=latest) +[](https://codecov.io/gh/bigcat88/pillow_heif) + + + + +[](https://pepy.tech/project/pillow-heif) +[](https://pepy.tech/project/pillow-heif) + + + + + + + +Python bindings to [libheif](https://github.com/strukturag/libheif) for working with HEIF images and plugin for Pillow. + +Features: + * Decoding of `8`, `10`, `12` bit HEIC and AVIF files. + * Encoding of `8`, `10`, `12` bit HEIC and AVIF files. + * `EXIF`, `XMP`, `IPTC` read & write support. + * Support of multiple images in one file and a `PrimaryImage` attribute. + * Adding & removing `thumbnails`. + * Adding HEIF support to Pillow in one line of code as a plugin. + +Note: Here is a light version [pi-heif](https://pypi.org/project/pi-heif/) of this project without encoding capabilities. + +### Install +```console +python3 -m pip install -U pip +python3 -m pip install pillow-heif +``` + +### Example of use as a Pillow plugin +```python3 +from PIL import Image +from pillow_heif import register_heif_opener + +register_heif_opener() + +im = Image.open("image.heic") # do whatever need with a Pillow image +im = im.rotate(13) +im.save(f"rotated_image.heic", quality=90) +``` + +### 16 bit PNG to 10 bit HEIF using OpenCV +```python3 +import cv2 +import pillow_heif + +cv_img = cv2.imread("16bit_with_alpha.png", cv2.IMREAD_UNCHANGED) +heif_file = pillow_heif.from_bytes( + mode="BGRA;16", + size=(cv_img.shape[1], cv_img.shape[0]), + data=bytes(cv_img) +) +heif_file.save("RGBA_10bit.heic", quality=-1) +``` + +### 8/10/12 bit HEIF to 8/16 bit PNG using OpenCV +```python3 +import numpy as np +import cv2 +import pillow_heif + +heif_file = pillow_heif.open_heif("image.heic", convert_hdr_to_8bit=False, bgr_mode=True) +np_array = np.asarray(heif_file) +cv2.imwrite("image.png", np_array) +``` + +### Accessing decoded image data +```python3 +import pillow_heif + +if pillow_heif.is_supported("image.heic"): + heif_file = pillow_heif.open_heif("image.heic", convert_hdr_to_8bit=False) + print("image size:", heif_file.size) + print("image mode:", heif_file.mode) + print("image data length:", len(heif_file.data)) + print("image data stride:", heif_file.stride) +``` + +### Get decoded image data as a Numpy array +```python3 +import numpy as np +import pillow_heif + +if pillow_heif.is_supported("input.heic"): + heif_file = pillow_heif.open_heif("input.heic") + np_array = np.asarray(heif_file) +``` + +### AVIF support + +Working with the `AVIF` files as the same as with the `HEIC` files. Just use a separate function to register plugin: +```python3 +import pillow_heif + +pillow_heif.register_avif_opener() +``` + +### More Information + +- [Documentation](https://pillow-heif.readthedocs.io/) + - [Installation](https://pillow-heif.readthedocs.io/en/latest/installation.html) + - [Pillow plugin](https://pillow-heif.readthedocs.io/en/latest/pillow-plugin.html) + - [Using HeifFile](https://pillow-heif.readthedocs.io/en/latest/heif-file.html) + - [Image modes](https://pillow-heif.readthedocs.io/en/latest/image-modes.html) + - [Options](https://pillow-heif.readthedocs.io/en/latest/options.html) +- [Examples](https://github.com/bigcat88/pillow_heif/tree/master/examples) +- [Contribute](https://github.com/bigcat88/pillow_heif/blob/master/.github/CONTRIBUTING.md) + - [Discussions](https://github.com/bigcat88/pillow_heif/discussions) + - [Issues](https://github.com/bigcat88/pillow_heif/issues) +- [Changelog](https://github.com/bigcat88/pillow_heif/blob/master/CHANGELOG.md) + +### Wheels + +| **_Wheels table_** | macOS<br/>Intel | macOS<br/>Silicon | Windows<br/>64bit | musllinux* | manylinux* | +|--------------------|:---------------:|:-----------------:|:-----------------:|:----------:|:----------:| +| CPython 3.7 | ✅ | N/A | ✅ | N/A | ✅ | +| CPython 3.8 | ✅ | ✅ | ✅ | ✅ | ✅ | +| CPython 3.9 | ✅ | ✅ | ✅ | ✅ | ✅ | +| CPython 3.10 | ✅ | ✅ | ✅ | ✅ | ✅ | +| CPython 3.11 | ✅ | ✅ | ✅ | ✅ | ✅ | +| PyPy 3.8 v7.3 | ✅ | N/A | ✅ | N/A | ✅ | +| PyPy 3.9 v7.3 | ✅ | N/A | ✅ | N/A | ✅ | + +* **i686**, **x86_64**, **aarch64** wheels. + +`ARMv7l`, `PyPy` 32-bit wheels are published only for [pi-heif](https://pypi.org/project/pi-heif/) from `0.10.0` version. + + +%prep +%autosetup -n pillow-heif-0.11.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-pillow-heif -f filelist.lst +%dir %{python3_sitearch}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.11.0-1 +- Package Spec generated @@ -0,0 +1 @@ +de8fdf72eb7cc367f0ee0682ae6caf0e pillow_heif-0.11.0.tar.gz |