diff --git a/.appveyor.yml b/.appveyor.yml index f490561cd..41a5725b2 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -34,8 +34,8 @@ install: - xcopy /S /Y c:\test-images-main\* c:\pillow\tests\images - curl -fsSL -o nasm-win64.zip https://raw.githubusercontent.com/python-pillow/pillow-depends/main/nasm-2.16.03-win64.zip - 7z x nasm-win64.zip -oc:\ -- choco install ghostscript --version=10.3.1 -- path c:\nasm-2.16.03;C:\Program Files\gs\gs10.03.1\bin;%PATH% +- choco install ghostscript --version=10.4.0 +- path c:\nasm-2.16.03;C:\Program Files\gs\gs10.04.0\bin;%PATH% - cd c:\pillow\winbuild\ - ps: | c:\python39\python.exe c:\pillow\winbuild\build_prepare.py -v --depends=C:\pillow-depends\ @@ -53,9 +53,8 @@ test_script: - cd c:\pillow - '%PYTHON%\%EXECUTABLE% -m pip install pytest pytest-cov pytest-timeout defusedxml ipython numpy olefile pyroma' - c:\"Program Files (x86)"\"Windows Kits"\10\Debuggers\x86\gflags.exe /p /enable %PYTHON%\%EXECUTABLE% -- '%PYTHON%\%EXECUTABLE% -c "from PIL import Image"' -- '%PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests' -#- '%PYTHON%\%EXECUTABLE% test-installed.py -v -s %TEST_OPTIONS%' TODO TEST_OPTIONS with pytest? +- path %PYTHON%;%PATH% +- .ci\test.cmd after_test: - curl -Os https://uploader.codecov.io/latest/windows/codecov.exe diff --git a/.ci/test.cmd b/.ci/test.cmd new file mode 100644 index 000000000..aafc9290c --- /dev/null +++ b/.ci/test.cmd @@ -0,0 +1,3 @@ +python.exe -c "from PIL import Image" +IF ERRORLEVEL 1 EXIT /B +python.exe -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term --cov-report xml Tests diff --git a/.ci/test.sh b/.ci/test.sh index 8ff7c5f64..3f0ddc350 100755 --- a/.ci/test.sh +++ b/.ci/test.sh @@ -4,4 +4,4 @@ set -e python3 -c "from PIL import Image" -python3 -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term Tests $REVERSE +python3 -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term --cov-report xml Tests $REVERSE diff --git a/.github/workflows/test-mingw.yml b/.github/workflows/test-mingw.yml index e5e1ec32e..c7a73439c 100644 --- a/.github/workflows/test-mingw.yml +++ b/.github/workflows/test-mingw.yml @@ -80,8 +80,7 @@ jobs: - name: Test Pillow run: | python3 selftest.py --installed - python3 -c "from PIL import Image" - python3 -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests + .ci/test.sh - name: Upload coverage uses: codecov/codecov-action@v4 diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index f58e8dae3..c8842e37b 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -86,8 +86,8 @@ jobs: choco install nasm --no-progress echo "C:\Program Files\NASM" >> $env:GITHUB_PATH - choco install ghostscript --version=10.3.1 --no-progress - echo "C:\Program Files\gs\gs10.03.1\bin" >> $env:GITHUB_PATH + choco install ghostscript --version=10.4.0 --no-progress + echo "C:\Program Files\gs\gs10.04.0\bin" >> $env:GITHUB_PATH # Install extra test images xcopy /S /Y Tests\test-images\* Tests\images @@ -190,8 +190,8 @@ jobs: - name: Test Pillow run: | - path %GITHUB_WORKSPACE%\\winbuild\\build\\bin;%PATH% - python.exe -m pytest -vx -W always --cov PIL --cov Tests --cov-report term --cov-report xml Tests + path %GITHUB_WORKSPACE%\winbuild\build\bin;%PATH% + .ci\test.cmd shell: cmd - name: Prepare to upload errors diff --git a/.github/workflows/wheels-dependencies.sh b/.github/workflows/wheels-dependencies.sh index 4d40f7fab..b5fbdc421 100755 --- a/.github/workflows/wheels-dependencies.sh +++ b/.github/workflows/wheels-dependencies.sh @@ -17,7 +17,7 @@ ARCHIVE_SDIR=pillow-depends-main # Package versions for fresh source builds FREETYPE_VERSION=2.13.2 if [[ "$MB_ML_VER" != 2014 ]]; then - HARFBUZZ_VERSION=9.0.0 + HARFBUZZ_VERSION=10.0.1 else HARFBUZZ_VERSION=8.5.0 fi diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 11564c142..d3c2ac44c 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -105,13 +105,18 @@ jobs: - name: "macOS 10.10 x86_64" os: macos-13 cibw_arch: x86_64 - build: "pp310* cp3{9,10,11}*" + build: "cp3{9,10,11}*" macosx_deployment_target: "10.10" - name: "macOS 10.13 x86_64" os: macos-13 cibw_arch: x86_64 build: "cp3{12,13}*" macosx_deployment_target: "10.13" + - name: "macOS 10.15 x86_64" + os: macos-13 + cibw_arch: x86_64 + build: "pp310*" + macosx_deployment_target: "10.15" - name: "macOS arm64" os: macos-latest cibw_arch: arm64 diff --git a/CHANGES.rst b/CHANGES.rst index f23ec609f..ae7370a79 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,27 @@ Changelog (Pillow) 11.0.0 (unreleased) ------------------- +- Fixed writing multiple StripOffsets to TIFF #8317 + [Yay295, radarhere] + +- Shared imagequant libraries may be located within usr/lib64 #8407 + [radarhere] + +- Fix dereference before checking for NULL in ImagingTransformAffine #8398 + [PavlNekrasov] + +- Use transposed size after opening for TIFF images #8390 + [radarhere, homm] + +- Improve ImageFont error messages #8338 + [yngvem, radarhere, hugovk] + +- Mention MAX_TEXT_CHUNK limit in PNG error message #8391 + [radarhere] + +- Cast Dib handle to int #8385 + [radarhere] + - Accept float stroke widths #8369 [radarhere] diff --git a/README.md b/README.md index b4c6d2987..5bbebaccb 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ As of 2019, Pillow development is Code coverage - Fuzzing Status diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index c00178bff..47632b8fa 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -116,7 +116,8 @@ class TestFileTiff: with Image.open("Tests/images/hopper_bigtiff.tif") as im: assert isinstance(im, TiffImagePlugin.TiffImageFile) - # multistrip support not yet implemented + # The data type of this file's StripOffsets tag is LONG8, + # which is not yet supported for offset data when saving multiple frames. del im.tag_v2[273] outfile = str(tmp_path / "temp.tif") diff --git a/Tests/test_file_tiff_metadata.py b/Tests/test_file_tiff_metadata.py index c131e16f4..8a9f10d98 100644 --- a/Tests/test_file_tiff_metadata.py +++ b/Tests/test_file_tiff_metadata.py @@ -189,6 +189,29 @@ def test_change_stripbytecounts_tag_type(tmp_path: Path) -> None: assert reloaded.tag_v2.tagtype[TiffImagePlugin.STRIPBYTECOUNTS] == TiffTags.LONG +def test_save_multiple_stripoffsets() -> None: + ifd = TiffImagePlugin.ImageFileDirectory_v2() + ifd[TiffImagePlugin.STRIPOFFSETS] = (123, 456) + assert ifd.tagtype[TiffImagePlugin.STRIPOFFSETS] == TiffTags.LONG + + # all values are in little-endian + assert ifd.tobytes() == ( + # number of tags == 1 + b"\x01\x00" + # tag id (2 bytes), type (2 bytes), count (4 bytes), value (4 bytes) + # TiffImagePlugin.STRIPOFFSETS, TiffTags.LONG, 2, 18 + # where STRIPOFFSETS is 273, LONG is 4 + # and 18 is the offset of the tag data + b"\x11\x01\x04\x00\x02\x00\x00\x00\x12\x00\x00\x00" + # end of entries + b"\x00\x00\x00\x00" + # 26 is the total number of bytes output, + # the offset for any auxiliary strip data that will then be appended + # (123 + 26, 456 + 26) == (149, 482) + b"\x95\x00\x00\x00\xe2\x01\x00\x00" + ) + + def test_no_duplicate_50741_tag() -> None: assert TAG_IDS["MakerNoteSafety"] == 50741 assert TAG_IDS["BestQualityScale"] == 50780 diff --git a/depends/install_imagequant.sh b/depends/install_imagequant.sh index 867b31e4d..060d9840e 100755 --- a/depends/install_imagequant.sh +++ b/depends/install_imagequant.sh @@ -23,7 +23,12 @@ else cargo cinstall --prefix=/usr --destdir=. # Copy into place - sudo cp usr/lib/libimagequant.so* /usr/lib/ + if [ -d "usr/lib64" ]; then + lib="lib64" + else + lib="lib" + fi + sudo cp usr/$lib/libimagequant.so* /usr/lib/ sudo cp usr/include/libimagequant.h /usr/include/ if [ -n "$GITHUB_ACTIONS" ]; then diff --git a/depends/install_raqm.sh b/depends/install_raqm.sh index 070ba23a1..5d862403e 100755 --- a/depends/install_raqm.sh +++ b/depends/install_raqm.sh @@ -2,7 +2,7 @@ # install raqm -archive=libraqm-0.10.1 +archive=libraqm-0.10.2 ./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/main/$archive.tar.gz diff --git a/docs/index.rst b/docs/index.rst index 3a12953f0..18f5c3d13 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -54,7 +54,7 @@ Pillow for enterprise is available via the Tidelift Subscription. `Learn more mode, imOut->mode) != 0) { + return (Imaging)ImagingError_ModeError(); + } + if (filterid || imIn->type == IMAGING_TYPE_SPECIAL) { return ImagingGenericTransform( imOut, imIn, x0, y0, x1, y1, affine_transform, a, filterid, fill @@ -1046,10 +1050,6 @@ ImagingTransformAffine( return ImagingScaleAffine(imOut, imIn, x0, y0, x1, y1, a, fill); } - if (!imOut || !imIn || strcmp(imIn->mode, imOut->mode) != 0) { - return (Imaging)ImagingError_ModeError(); - } - if (x0 < 0) { x0 = 0; } diff --git a/winbuild/build_prepare.py b/winbuild/build_prepare.py index e2022d283..84ad6417e 100644 --- a/winbuild/build_prepare.py +++ b/winbuild/build_prepare.py @@ -112,7 +112,7 @@ V = { "BROTLI": "1.1.0", "FREETYPE": "2.13.3", "FRIBIDI": "1.0.15", - "HARFBUZZ": "9.0.0", + "HARFBUZZ": "10.0.1", "JPEGTURBO": "3.0.4", "LCMS2": "2.16", "LIBPNG": "1.6.44", @@ -292,8 +292,12 @@ DEPS: dict[str, dict[str, Any]] = { }, "build": [ cmd_rmdir("objs"), - cmd_msbuild("MSBuild.sln", "Release Static", "Clean"), - cmd_msbuild("MSBuild.sln", "Release Static", "Build"), + cmd_msbuild( + r"builds\windows\vc2010\freetype.vcxproj", "Release Static", "Clean" + ), + cmd_msbuild( + r"builds\windows\vc2010\freetype.vcxproj", "Release Static", "Build" + ), cmd_xcopy("include", "{inc_dir}"), ], "libs": [r"objs\{msbuild_arch}\Release Static\freetype.lib"],