Skip to content

Commit

Permalink
- Added support for Pillow >= 10.1
Browse files Browse the repository at this point in the history
- Updated version of ``libheif-rs`` to 1.0.
- Updated version of ``pyo3`` to 0.20.
  • Loading branch information
Cykooz committed Jan 26, 2024
1 parent 923ffb1 commit 08b1039
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 16 deletions.
14 changes: 14 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@
CHANGELOG
*********

1.0.0 (2024-01-26)
=================

Features
--------

- Added support for Pillow >= 10.1

Changes
-------

- Updated version of ``libheif-rs`` to 1.0.
- Updated version of ``pyo3`` to 0.20.

0.14 (2023-09-09)
=================

Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ crate-type = ["cdylib"]


[dependencies]
libheif-rs = { version = "0.22.0" }
pyo3 = "0.19.2"
libheif-rs = { version = "1.0" }
pyo3 = "0.20"


[profile.release]
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Installation from source

System requirements:

- libheif-dev >= 1.16 (https://github.com/strukturag/libheif)
- libheif-dev >= 1.17 (https://github.com/strukturag/libheif)
- python3-dev
- Rust 1.72+ (https://www.rust-lang.org/)
- CLang
Expand Down
10 changes: 5 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ RUN mkdir /workdir "${CARGO_TARGET_DIR}"


# libheif: step1 - get sources
ENV LIBHEIF_VERSION 1.16.2
ENV LIBHEIF_VERSION 1.17.6
RUN set -ex \
&& cd /build-deps \
&& wget https://github.com/strukturag/libheif/releases/download/v${LIBHEIF_VERSION}/libheif-${LIBHEIF_VERSION}.tar.gz \
&& tar xvf libheif-${LIBHEIF_VERSION}.tar.gz \
&& cd libheif-${LIBHEIF_VERSION} \
&& mkdir -p third-party \
&& cd third-party \
&& git clone -b 0.6 --depth 1 https://github.com/xiph/rav1e.git \
&& git clone -b 1.2.1 --depth 1 https://code.videolan.org/videolan/dav1d.git \
&& git clone -b v1.3.1 --depth 1 https://chromium.googlesource.com/webm/libwebp
&& git clone -b v0.7.1 --depth 1 https://github.com/xiph/rav1e.git \
&& git clone -b 1.3.0 --depth 1 https://code.videolan.org/videolan/dav1d.git \
&& git clone -b v1.3.2 --depth 1 https://chromium.googlesource.com/webm/libwebp

# libheif: step2 - rav1e
RUN set -ex \
Expand Down Expand Up @@ -114,7 +114,7 @@ RUN set -ex \

RUN set -ex \
&& source $HOME/.cargo/env \
&& declare -a pythons=("cp38-cp38" "cp39-cp39" "cp310-cp310" "cp311-cp311") \
&& declare -a pythons=("cp38-cp38" "cp39-cp39" "cp310-cp310" "cp311-cp311" "cp312-cp312") \
&& for PY in "${pythons[@]}"; do \
cd "/opt/python/${PY}/bin/" \
&& ./pip install --upgrade pip auditwheel twine setuptools maturin \
Expand Down
7 changes: 2 additions & 5 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,14 @@ rm -rf docker tests build_wheels.sh


source "$HOME/.cargo/env"
PYTHONS=("8" "9" "10" "11")
PYTHONS=("8" "9" "10" "11" "12")
mkdir "${RESULT}/repaired"
SDIST_OPT="--sdist"
for PY_MINOR in "${PYTHONS[@]}"; do
PY="3${PY_MINOR}"
echo ""
echo "Build wheel for Python 3.${PY_MINOR}"
PY_BIN_DIR="/opt/python/cp${PY}-cp${PY}m/bin/"
if [ ! -d "${PY_BIN_DIR}" ]; then
PY_BIN_DIR="/opt/python/cp${PY}-cp${PY}/bin/"
fi;
PY_BIN_DIR="/opt/python/cp${PY}-cp${PY}/bin"
cd "${WORKDIR}/cykooz-heif"
mkdir "${RESULT}/wheelhouse${PY}"
PYTHON_SYS_EXECUTABLE="${PY_BIN_DIR}/python" "${PY_BIN_DIR}/maturin" build \
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ build-backend = "maturin"

[project]
name = "cykooz.heif"
version = "0.14.0"
version = "1.0.0"
description = "A decoder of HEIF format of images"
readme = "README.rst"
classifiers = [
"Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Rust",
"Topic :: Multimedia :: Graphics",
Expand Down
6 changes: 5 additions & 1 deletion python/cykooz/heif/pil.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ def _open(self):
self._size = raw_heif_image.width, raw_heif_image.height

# mode setting
self.mode = raw_heif_image.mode
if hasattr(self, '_mode'):
self._mode = raw_heif_image.mode
else:
# Support Pillow < 10.1.0
self.mode = raw_heif_image.mode

exif = raw_heif_image.exif
if exif:
Expand Down

0 comments on commit 08b1039

Please sign in to comment.