Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minimum supported pillow>=9.5.0 #216

Merged
merged 3 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/analysis-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:

- name: Install from source
run: |
python3 -m pip install pillow==9.5.0
python3 -m pip install pillow==10.2.0
python3 -m pip -v install ".[dev]"

- name: LibHeif info
Expand Down Expand Up @@ -207,7 +207,7 @@ jobs:

- name: Install from source
run: |
python -m pip install pillow==9.2.0
python -m pip install pillow==9.5.0
python -m pip -v install ".[dev]"

- name: LibHeif info
Expand Down Expand Up @@ -251,7 +251,7 @@ jobs:

- name: Install from source
run: |
sudo -H python3 -m pip install pillow==9.3.0 pytest defusedxml packaging numpy coverage
sudo -H python3 -m pip install pillow==10.0.1 pytest defusedxml packaging numpy coverage
sudo -H PH_LIGHT_ACTION=1 python3 libheif/linux_build_libs.py
sudo -H python3 -m pip -v install --no-build-isolation .

Expand Down Expand Up @@ -298,7 +298,7 @@ jobs:

- name: Install from source
run: |
sudo -H python3 -m pip install pillow==9.4.0 pytest defusedxml packaging numpy
sudo -H python3 -m pip install pillow==10.1.0 pytest defusedxml packaging numpy
sudo -H PH_LIGHT_ACTION=1 python3 libheif/linux_build_libs.py
sudo -H python3 -m pip -v install --no-build-isolation .

Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ This release contains breaking change for monochrome images.

- `convert_hdr_to_8bit` value now ignores `monochrome` images. #215
- `subsampling` parameter for encoding has higher priority then `chroma`. #213
- the minimum required `libehif` version is `1.17.0`. #214
- Minimum required `libehif` version is `1.17.0`. #214
- Minimum supported Pillow version raised to `9.5.0`. #216

## [0.15.0 - 2024-02-03]

Expand Down
6 changes: 5 additions & 1 deletion docker/from_src/Debian_12.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ RUN \
apt-get -qq update && \
apt-get -y -q install \
python3-pip \
python3-pillow \
python3-dev \
python3-setuptools \
libtiff5-dev libjpeg62-turbo-dev libopenjp2-7-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk \
libharfbuzz-dev libfribidi-dev libxcb1-dev \
libffi-dev \
libtool \
git \
Expand Down
2 changes: 1 addition & 1 deletion pi-heif/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ python_requires = >=3.8
zip_safe = False
packages = find:
install_requires =
pillow>=9.2.0
pillow>=9.5.0

[options.extras_require]
tests-min =
Expand Down
8 changes: 2 additions & 6 deletions pillow_heif/as_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ def load(self):
if self._heif_file:
frame_heif = self._heif_file[self.tell()]
try:
if pil_version[:4] not in ("9.2.", "9.3.", "9.4."): # noqa: SIM108
data = frame_heif.data
else:
data = bytes(frame_heif.data)
# Size of Image can change during decoding
data = frame_heif.data # Size of Image can change during decoding
self._size = frame_heif.size # noqa
self.load_prepare()
self.frombytes(data, "raw", (frame_heif.mode, frame_heif.stride))
Expand Down Expand Up @@ -123,7 +119,7 @@ def _seek_check(self, frame):
def _init_from_heif_file(self, img_index: int) -> None:
if self._heif_file:
self._size = self._heif_file[img_index].size
if pil_version[:4] not in ("9.2.", "9.3.", "9.4.", "9.5.", "10.0"):
if pil_version[:4] not in ("9.5.", "10.0"):
# starting from Pillow 10.1, `mode` is a readonly property.
self._mode = self._heif_file[img_index].mode
else:
Expand Down
2 changes: 1 addition & 1 deletion pillow_heif/heif.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def to_pillow(self) -> Image.Image:
return Image.frombytes(
self.mode, # noqa
self.size,
bytes(self.data),
self.data,
"raw",
self.mode,
self.stride,
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ python_requires = >=3.8
zip_safe = False
packages = find:
install_requires =
pillow>=9.2.0
pillow>=9.5.0

[options.extras_require]
docs =
Expand Down
6 changes: 1 addition & 5 deletions tests/metadata_exif_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import helpers
import pytest
from packaging.version import parse as parse_version
from PIL import Image
from PIL import __version__ as pil_version
from PIL import features
from PIL import Image, features

import pillow_heif

Expand All @@ -16,7 +13,6 @@
@pytest.mark.skipif(not features.check("webp"), reason="Requires WEBP support.")
@pytest.mark.skipif(not helpers.aom(), reason="Requires AVIF support.")
@pytest.mark.skipif(not helpers.hevc_enc(), reason="Requires HEVC encoder.")
@pytest.mark.skipif(parse_version(pil_version) < parse_version("9.2.0"), reason="Requires Pillow >= 9.2")
@pytest.mark.parametrize("save_format", ("HEIF", "AVIF"))
@pytest.mark.parametrize(
"im_format",
Expand Down
5 changes: 2 additions & 3 deletions tests/metadata_xmp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@
)
def test_xmp_from_pillow(img_path, save_format):
im = Image.open(Path(img_path))
if hasattr(im, "getxmp"): # WebP do not have `getxmp` method(Pillow <=9.3.0)
xmp = im.getxmp() # noqa
assert xmp["xmpmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"] == "TestSubject"
xmp = im.getxmp() # noqa
assert xmp["xmpmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"] == "TestSubject"
out_im_heif = BytesIO()
im.save(out_im_heif, format=save_format)
im_heif = Image.open(out_im_heif)
Expand Down
Loading