Skip to content

Commit f1ca852

Browse files
authored
minimum supported pillow>=9.5.0 (#216)
* minimum supported pillow>=9.5.0 --------- Signed-off-by: Alexander Piskun <[email protected]>
1 parent 81072f7 commit f1ca852

File tree

9 files changed

+19
-23
lines changed

9 files changed

+19
-23
lines changed

.github/workflows/analysis-coverage.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
5353
- name: Install from source
5454
run: |
55-
python3 -m pip install pillow==9.5.0
55+
python3 -m pip install pillow==10.2.0
5656
python3 -m pip -v install ".[dev]"
5757
5858
- name: LibHeif info
@@ -207,7 +207,7 @@ jobs:
207207
208208
- name: Install from source
209209
run: |
210-
python -m pip install pillow==9.2.0
210+
python -m pip install pillow==9.5.0
211211
python -m pip -v install ".[dev]"
212212
213213
- name: LibHeif info
@@ -251,7 +251,7 @@ jobs:
251251
252252
- name: Install from source
253253
run: |
254-
sudo -H python3 -m pip install pillow==9.3.0 pytest defusedxml packaging numpy coverage
254+
sudo -H python3 -m pip install pillow==10.0.1 pytest defusedxml packaging numpy coverage
255255
sudo -H PH_LIGHT_ACTION=1 python3 libheif/linux_build_libs.py
256256
sudo -H python3 -m pip -v install --no-build-isolation .
257257
@@ -298,7 +298,7 @@ jobs:
298298
299299
- name: Install from source
300300
run: |
301-
sudo -H python3 -m pip install pillow==9.4.0 pytest defusedxml packaging numpy
301+
sudo -H python3 -m pip install pillow==10.1.0 pytest defusedxml packaging numpy
302302
sudo -H PH_LIGHT_ACTION=1 python3 libheif/linux_build_libs.py
303303
sudo -H python3 -m pip -v install --no-build-isolation .
304304

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ This release contains breaking change for monochrome images.
1212

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

1718
## [0.15.0 - 2024-02-03]
1819

docker/from_src/Debian_12.Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ RUN \
44
apt-get -qq update && \
55
apt-get -y -q install \
66
python3-pip \
7-
python3-pillow \
7+
python3-dev \
8+
python3-setuptools \
9+
libtiff5-dev libjpeg62-turbo-dev libopenjp2-7-dev zlib1g-dev \
10+
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk \
11+
libharfbuzz-dev libfribidi-dev libxcb1-dev \
812
libffi-dev \
913
libtool \
1014
git \

pi-heif/setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ python_requires = >=3.8
3737
zip_safe = False
3838
packages = find:
3939
install_requires =
40-
pillow>=9.2.0
40+
pillow>=9.5.0
4141

4242
[options.extras_require]
4343
tests-min =

pillow_heif/as_plugin.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ def load(self):
5656
if self._heif_file:
5757
frame_heif = self._heif_file[self.tell()]
5858
try:
59-
if pil_version[:4] not in ("9.2.", "9.3.", "9.4."): # noqa: SIM108
60-
data = frame_heif.data
61-
else:
62-
data = bytes(frame_heif.data)
63-
# Size of Image can change during decoding
59+
data = frame_heif.data # Size of Image can change during decoding
6460
self._size = frame_heif.size # noqa
6561
self.load_prepare()
6662
self.frombytes(data, "raw", (frame_heif.mode, frame_heif.stride))
@@ -123,7 +119,7 @@ def _seek_check(self, frame):
123119
def _init_from_heif_file(self, img_index: int) -> None:
124120
if self._heif_file:
125121
self._size = self._heif_file[img_index].size
126-
if pil_version[:4] not in ("9.2.", "9.3.", "9.4.", "9.5.", "10.0"):
122+
if pil_version[:4] not in ("9.5.", "10.0"):
127123
# starting from Pillow 10.1, `mode` is a readonly property.
128124
self._mode = self._heif_file[img_index].mode
129125
else:

pillow_heif/heif.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def to_pillow(self) -> Image.Image:
9595
return Image.frombytes(
9696
self.mode, # noqa
9797
self.size,
98-
bytes(self.data),
98+
self.data,
9999
"raw",
100100
self.mode,
101101
self.stride,

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ python_requires = >=3.8
3737
zip_safe = False
3838
packages = find:
3939
install_requires =
40-
pillow>=9.2.0
40+
pillow>=9.5.0
4141

4242
[options.extras_require]
4343
docs =

tests/metadata_exif_test.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
import helpers
44
import pytest
5-
from packaging.version import parse as parse_version
6-
from PIL import Image
7-
from PIL import __version__ as pil_version
8-
from PIL import features
5+
from PIL import Image, features
96

107
import pillow_heif
118

@@ -16,7 +13,6 @@
1613
@pytest.mark.skipif(not features.check("webp"), reason="Requires WEBP support.")
1714
@pytest.mark.skipif(not helpers.aom(), reason="Requires AVIF support.")
1815
@pytest.mark.skipif(not helpers.hevc_enc(), reason="Requires HEVC encoder.")
19-
@pytest.mark.skipif(parse_version(pil_version) < parse_version("9.2.0"), reason="Requires Pillow >= 9.2")
2016
@pytest.mark.parametrize("save_format", ("HEIF", "AVIF"))
2117
@pytest.mark.parametrize(
2218
"im_format",

tests/metadata_xmp_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@
3030
)
3131
def test_xmp_from_pillow(img_path, save_format):
3232
im = Image.open(Path(img_path))
33-
if hasattr(im, "getxmp"): # WebP do not have `getxmp` method(Pillow <=9.3.0)
34-
xmp = im.getxmp() # noqa
35-
assert xmp["xmpmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"] == "TestSubject"
33+
xmp = im.getxmp() # noqa
34+
assert xmp["xmpmeta"]["RDF"]["Description"]["subject"]["Bag"]["li"] == "TestSubject"
3635
out_im_heif = BytesIO()
3736
im.save(out_im_heif, format=save_format)
3837
im_heif = Image.open(out_im_heif)

0 commit comments

Comments
 (0)