Skip to content

Commit bb06057

Browse files
authored
Merge branch 'main' into jxl-support2
2 parents 13944d5 + cb2a0c4 commit bb06057

File tree

116 files changed

+1631
-794
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+1631
-794
lines changed

.appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ build_script:
5151

5252
test_script:
5353
- cd c:\pillow
54-
- '%PYTHON%\%EXECUTABLE% -m pip install pytest pytest-cov pytest-timeout defusedxml numpy olefile pyroma'
54+
- '%PYTHON%\%EXECUTABLE% -m pip install pytest pytest-cov pytest-timeout defusedxml ipython numpy olefile pyroma'
5555
- c:\"Program Files (x86)"\"Windows Kits"\10\Debuggers\x86\gflags.exe /p /enable %PYTHON%\%EXECUTABLE%
5656
- '%PYTHON%\%EXECUTABLE% -c "from PIL import Image"'
5757
- '%PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests'

.ci/install.sh

+3-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ set -e
2121

2222
if [[ $(uname) != CYGWIN* ]]; then
2323
sudo apt-get -qq install libfreetype6-dev liblcms2-dev python3-tk\
24-
ghostscript libffi-dev libjpeg-turbo-progs libopenjp2-7-dev\
24+
ghostscript libjpeg-turbo-progs libopenjp2-7-dev\
2525
cmake meson imagemagick libharfbuzz-dev libfribidi-dev\
2626
sway wl-clipboard libopenblas-dev
2727
fi
@@ -30,6 +30,7 @@ python3 -m pip install --upgrade pip
3030
python3 -m pip install --upgrade wheel
3131
python3 -m pip install coverage
3232
python3 -m pip install defusedxml
33+
python3 -m pip install ipython
3334
python3 -m pip install olefile
3435
python3 -m pip install -U pytest
3536
python3 -m pip install -U pytest-cov
@@ -52,10 +53,7 @@ if [[ $(uname) != CYGWIN* ]]; then
5253
fi
5354

5455
# Pyroma uses non-isolated build and fails with old setuptools
55-
if [[
56-
$GHA_PYTHON_VERSION == pypy3.9
57-
|| $GHA_PYTHON_VERSION == 3.9
58-
]]; then
56+
if [[ $GHA_PYTHON_VERSION == 3.9 ]]; then
5957
# To match pyproject.toml
6058
python3 -m pip install "setuptools>=67.8"
6159
fi

.ci/requirements-mypy.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
mypy==1.11.1
1+
mypy==1.11.2
22
IceSpringPySideStubs-PyQt6
33
IceSpringPySideStubs-PySide6
44
ipython
55
numpy
66
packaging
77
pytest
8+
sphinx
9+
types-atheris
810
types-defusedxml
911
types-olefile
1012
types-setuptools

.github/workflows/macos-install.sh

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
set -e
44

5+
if [[ "$ImageOS" == "macos13" ]]; then
6+
brew uninstall gradle maven
7+
fi
58
brew install \
69
freetype \
710
ghostscript \
@@ -20,6 +23,7 @@ export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"
2023

2124
python3 -m pip install coverage
2225
python3 -m pip install defusedxml
26+
python3 -m pip install ipython
2327
python3 -m pip install olefile
2428
python3 -m pip install -U pytest
2529
python3 -m pip install -U pytest-cov

.github/workflows/test-cygwin.yml

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ jobs:
7474
perl
7575
python3${{ matrix.python-minor-version }}-cython
7676
python3${{ matrix.python-minor-version }}-devel
77+
python3${{ matrix.python-minor-version }}-ipython
7778
python3${{ matrix.python-minor-version }}-numpy
7879
python3${{ matrix.python-minor-version }}-sip
7980
python3${{ matrix.python-minor-version }}-tkinter

.github/workflows/test-windows.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
strategy:
3636
fail-fast: false
3737
matrix:
38-
python-version: ["pypy3.10", "pypy3.9", "3.9", "3.10", "3.11", "3.12", "3.13"]
38+
python-version: ["pypy3.10", "3.9", "3.10", "3.11", "3.12", "3.13"]
3939

4040
timeout-minutes: 30
4141

@@ -87,7 +87,7 @@ jobs:
8787
echo "C:\Program Files\NASM" >> $env:GITHUB_PATH
8888
8989
choco install ghostscript --version=10.3.1 --no-progress
90-
echo "C:\Program Files\gs\gs10.00.0\bin" >> $env:GITHUB_PATH
90+
echo "C:\Program Files\gs\gs10.03.1\bin" >> $env:GITHUB_PATH
9191
9292
# Install extra test images
9393
xcopy /S /Y Tests\test-images\* Tests\images

.github/workflows/test.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ jobs:
4242
]
4343
python-version: [
4444
"pypy3.10",
45-
"pypy3.9",
4645
"3.13",
4746
"3.12",
4847
"3.11",
@@ -77,7 +76,7 @@ jobs:
7776
"pyproject.toml"
7877
7978
- name: Set up Python ${{ matrix.python-version }} (free-threaded)
80-
uses: deadsnakes/action@v3.1.0
79+
uses: deadsnakes/action@v3.2.0
8180
if: "${{ matrix.disable-gil }}"
8281
with:
8382
python-version: ${{ matrix.python-version }}

.github/workflows/wheels-dependencies.sh

+34-13
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ ARCHIVE_SDIR=pillow-depends-main
1616

1717
# Package versions for fresh source builds
1818
FREETYPE_VERSION=2.13.2
19-
HARFBUZZ_VERSION=8.5.0
19+
if [[ "$MB_ML_VER" != 2014 ]]; then
20+
HARFBUZZ_VERSION=9.0.0
21+
else
22+
HARFBUZZ_VERSION=8.5.0
23+
fi
2024
LIBPNG_VERSION=1.6.43
2125
JPEGTURBO_VERSION=3.0.3
2226
OPENJPEG_VERSION=2.5.2
@@ -40,7 +44,7 @@ BROTLI_VERSION=1.1.0
4044

4145
if [[ -n "$IS_MACOS" ]] && [[ "$CIBW_ARCHS" == "x86_64" ]]; then
4246
function build_openjpeg {
43-
local out_dir=$(fetch_unpack https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz openjpeg-${OPENJPEG_VERSION}.tar.gz)
47+
local out_dir=$(fetch_unpack https://github.com/uclouvain/openjpeg/archive/v$OPENJPEG_VERSION.tar.gz openjpeg-$OPENJPEG_VERSION.tar.gz)
4448
(cd $out_dir \
4549
&& cmake -DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX -DCMAKE_INSTALL_NAME_DIR=$BUILD_PREFIX/lib . \
4650
&& make install)
@@ -50,7 +54,7 @@ fi
5054

5155
function build_brotli {
5256
local cmake=$(get_modern_cmake)
53-
local out_dir=$(fetch_unpack https://github.com/google/brotli/archive/v$BROTLI_VERSION.tar.gz brotli-1.1.0.tar.gz)
57+
local out_dir=$(fetch_unpack https://github.com/google/brotli/archive/v$BROTLI_VERSION.tar.gz brotli-$BROTLI_VERSION.tar.gz)
5458
(cd $out_dir \
5559
&& $cmake -DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX -DCMAKE_INSTALL_NAME_DIR=$BUILD_PREFIX/lib . \
5660
&& make install)
@@ -60,6 +64,25 @@ function build_brotli {
6064
fi
6165
}
6266

67+
function build_harfbuzz {
68+
if [[ "$HARFBUZZ_VERSION" == 8.5.0 ]]; then
69+
export FREETYPE_LIBS=-lfreetype
70+
export FREETYPE_CFLAGS=-I/usr/local/include/freetype2/
71+
build_simple harfbuzz $HARFBUZZ_VERSION https://github.com/harfbuzz/harfbuzz/releases/download/$HARFBUZZ_VERSION tar.xz --with-freetype=yes --with-glib=no
72+
export FREETYPE_LIBS=""
73+
export FREETYPE_CFLAGS=""
74+
else
75+
local out_dir=$(fetch_unpack https://github.com/harfbuzz/harfbuzz/releases/download/$HARFBUZZ_VERSION/$HARFBUZZ_VERSION.tar.xz harfbuzz-$HARFBUZZ_VERSION.tar.xz)
76+
(cd $out_dir \
77+
&& meson setup build --buildtype=release -Dfreetype=enabled -Dglib=disabled)
78+
(cd $out_dir/build \
79+
&& meson install)
80+
if [[ "$MB_ML_LIBC" == "manylinux" ]]; then
81+
cp /usr/local/lib64/libharfbuzz* /usr/local/lib
82+
fi
83+
fi
84+
}
85+
6386
function build {
6487
if [[ -n "$IS_MACOS" ]] && [[ "$CIBW_ARCHS" == "arm64" ]]; then
6588
sudo chown -R runner /usr/local
@@ -109,15 +132,7 @@ function build {
109132
build_freetype
110133
fi
111134

112-
if [ -z "$IS_MACOS" ]; then
113-
export FREETYPE_LIBS=-lfreetype
114-
export FREETYPE_CFLAGS=-I/usr/local/include/freetype2/
115-
fi
116-
build_simple harfbuzz $HARFBUZZ_VERSION https://github.com/harfbuzz/harfbuzz/releases/download/$HARFBUZZ_VERSION tar.xz --with-freetype=yes --with-glib=no
117-
if [ -z "$IS_MACOS" ]; then
118-
export FREETYPE_LIBS=""
119-
export FREETYPE_CFLAGS=""
120-
fi
135+
build_harfbuzz
121136
}
122137

123138
# Any stuff that you need to do before you start building the wheels
@@ -140,7 +155,13 @@ if [[ -n "$IS_MACOS" ]]; then
140155
brew remove --ignore-dependencies webp
141156
fi
142157

143-
brew install pkg-config
158+
brew install meson pkg-config
159+
elif [[ "$MB_ML_LIBC" == "manylinux" ]]; then
160+
if [[ "$HARFBUZZ_VERSION" != 8.5.0 ]]; then
161+
yum install -y meson
162+
fi
163+
else
164+
apk add meson
144165
fi
145166

146167
wrap_wheel_builder build

.github/workflows/wheels.yml

-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ jobs:
4848
fail-fast: false
4949
matrix:
5050
python-version:
51-
- pp39
5251
- pp310
5352
- cp3{9,10,11}
5453
- cp3{12,13}
@@ -57,7 +56,6 @@ jobs:
5756
- manylinux_2_28
5857
- musllinux
5958
exclude:
60-
- { python-version: pp39, spec: musllinux }
6159
- { python-version: pp310, spec: musllinux }
6260

6361
steps:

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.5.6
3+
rev: v0.6.3
44
hooks:
55
- id: ruff
66
args: [--exit-non-zero-on-fix]
77

88
- repo: https://github.com/psf/black-pre-commit-mirror
9-
rev: 24.4.2
9+
rev: 24.8.0
1010
hooks:
1111
- id: black
1212

@@ -50,7 +50,7 @@ repos:
5050
exclude: ^.github/.*TEMPLATE|^Tests/(fonts|images)/
5151

5252
- repo: https://github.com/python-jsonschema/check-jsonschema
53-
rev: 0.29.1
53+
rev: 0.29.2
5454
hooks:
5555
- id: check-github-workflows
5656
- id: check-readthedocs
@@ -67,7 +67,7 @@ repos:
6767
- id: pyproject-fmt
6868

6969
- repo: https://github.com/abravalheri/validate-pyproject
70-
rev: v0.18
70+
rev: v0.19
7171
hooks:
7272
- id: validate-pyproject
7373

CHANGES.rst

+63
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,69 @@ Changelog (Pillow)
55
11.0.0 (unreleased)
66
-------------------
77

8+
- Deprecate ICNS (width, height, scale) sizes in favour of load(scale) #8352
9+
[radarhere]
10+
11+
- Improved handling of RGBA palettes when saving GIF images #8366
12+
[radarhere]
13+
14+
- Deprecate isImageType #8364
15+
[radarhere]
16+
17+
- Support converting more modes to LAB by converting to RGBA first #8358
18+
[radarhere]
19+
20+
- Deprecate support for FreeType 2.9.0 #8356
21+
[hugovk, radarhere]
22+
23+
- Removed unused TiffImagePlugin IFD_LEGACY_API #8355
24+
[radarhere]
25+
26+
- Handle duplicate EXIF header #8350
27+
[zakajd, radarhere]
28+
29+
- Return early from BoxBlur if either width or height is zero #8347
30+
[radarhere]
31+
32+
- Check text is either string or bytes #8308
33+
[radarhere]
34+
35+
- Added writing XMP bytes to JPEG #8286
36+
[radarhere]
37+
38+
- Support JPEG2000 RGBA palettes #8256
39+
[radarhere]
40+
41+
- Expand C image to match GIF frame image size #8237
42+
[radarhere]
43+
44+
- Allow saving I;16 images as PPM #8231
45+
[radarhere]
46+
47+
- When IFD is missing, connect get_ifd() dictionary to Exif #8230
48+
[radarhere]
49+
50+
- Skip truncated ICO mask if LOAD_TRUNCATED_IMAGES is enabled #8180
51+
[radarhere]
52+
53+
- Treat unknown JPEG2000 colorspace as unspecified #8343
54+
[radarhere]
55+
56+
- Updated error message when saving WebP with invalid width or height #8322
57+
[radarhere, hugovk]
58+
59+
- Remove warning if NumPy failed to raise an error during conversion #8326
60+
[radarhere]
61+
62+
- If left and right sides meet in ImageDraw.rounded_rectangle(), do not draw rectangle to fill gap #8304
63+
[radarhere]
64+
65+
- Remove WebP support without anim, mux/demux, and with buggy alpha #8213
66+
[homm, radarhere]
67+
68+
- Add missing TIFF CMYK;16B reader #8298
69+
[homm]
70+
871
- Remove all WITH_* flags from _imaging.c and other flags #8211
972
[homm]
1073

Loading
415 Bytes
Loading

Tests/oss-fuzz/fuzz_font.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616

1717

1818
import atheris
19+
from atheris.import_hook import instrument_imports
1920

20-
with atheris.instrument_imports():
21+
with instrument_imports():
2122
import sys
2223

2324
import fuzzers

Tests/oss-fuzz/fuzz_pillow.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414

1515

1616
import atheris
17+
from atheris.import_hook import instrument_imports
1718

18-
with atheris.instrument_imports():
19+
with instrument_imports():
1920
import sys
2021

2122
import fuzzers

Tests/oss-fuzz/python.supp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
<py3_8_encode_current_locale>
2+
<py3_10_encode_current_locale>
33
Memcheck:Cond
44
...
55
fun:encode_current_locale

Tests/test_box_blur.py

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ def test_color_modes() -> None:
7171
box_blur(sample.convert("YCbCr"))
7272

7373

74+
@pytest.mark.parametrize("size", ((0, 1), (1, 0)))
75+
def test_zero_dimension(size: tuple[int, int]) -> None:
76+
assert box_blur(Image.new("L", size)).size == size
77+
78+
7479
def test_radius_0() -> None:
7580
assert_blur(
7681
sample,

Tests/test_color_lut.py

-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ def test_correct_args(
120120
self, lut_mode: str, table_channels: int, table_size: int | tuple[int, int, int]
121121
) -> None:
122122
im = Image.new("RGB", (10, 10), 0)
123-
assert im.im is not None
124123
im.im.color_lut_3d(
125124
lut_mode,
126125
Image.Resampling.BILINEAR,
@@ -142,7 +141,6 @@ def test_wrong_mode(
142141
) -> None:
143142
with pytest.raises(ValueError, match="wrong mode"):
144143
im = Image.new(image_mode, (10, 10), 0)
145-
assert im.im is not None
146144
im.im.color_lut_3d(
147145
lut_mode,
148146
Image.Resampling.BILINEAR,
@@ -162,7 +160,6 @@ def test_correct_mode(
162160
self, image_mode: str, lut_mode: str, table_channels: int, table_size: int
163161
) -> None:
164162
im = Image.new(image_mode, (10, 10), 0)
165-
assert im.im is not None
166163
im.im.color_lut_3d(
167164
lut_mode,
168165
Image.Resampling.BILINEAR,

0 commit comments

Comments
 (0)