diff --git a/.appveyor.yml b/.appveyor.yml index 8ef91212da5..a77033ec136 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,5 +1,4 @@ version: '{build}' -image: Visual Studio 2017 clone_folder: c:\pillow init: - ECHO %PYTHON% @@ -8,21 +7,22 @@ init: environment: EXECUTABLE: python.exe - PIP_DIR: Scripts TEST_OPTIONS: DEPLOY: YES matrix: - - PYTHON: C:/Python38 + - PYTHON: C:/Python39 ARCHITECTURE: x86 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - PYTHON: C:/Python36-x64 ARCHITECTURE: x64 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 install: - curl -fsSL -o pillow-depends.zip https://github.com/python-pillow/pillow-depends/archive/master.zip - 7z x pillow-depends.zip -oc:\ - mv c:\pillow-depends-master c:\pillow-depends -- xcopy /s c:\pillow-depends\test_images\* c:\pillow\tests\images +- xcopy /S /Y c:\pillow-depends\test_images\* c:\pillow\tests\images - 7z x ..\pillow-depends\nasm-2.14.02-win64.zip -oc:\ - ..\pillow-depends\gs9533w32.exe /S - path c:\nasm-2.14.02;C:\Program Files (x86)\gs\gs9.53.3\bin;%PATH% @@ -32,6 +32,7 @@ install: c:\pillow\winbuild\build\build_dep_all.cmd $host.SetShouldExit(0) - path C:\pillow\winbuild\build\bin;%PATH% +- '%PYTHON%\%EXECUTABLE% -m pip install -U "setuptools>=49.3.2"' build_script: - ps: | @@ -42,13 +43,13 @@ build_script: test_script: - cd c:\pillow -- '%PYTHON%\%PIP_DIR%\pip.exe install pytest pytest-cov' +- '%PYTHON%\%EXECUTABLE% -m pip install pytest pytest-cov' - c:\"Program Files (x86)"\"Windows Kits"\10\Debuggers\x86\gflags.exe /p /enable %PYTHON%\%EXECUTABLE% - '%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? after_test: -- pip install codecov +- python -m pip install codecov - codecov --file coverage.xml --name %PYTHON% --flags AppVeyor matrix: @@ -65,7 +66,7 @@ artifacts: before_deploy: - cd c:\pillow - - '%PYTHON%\%PIP_DIR%\pip.exe install wheel' + - '%PYTHON%\%EXECUTABLE% -m pip install wheel' - cd c:\pillow\winbuild\ - c:\pillow\winbuild\build\build_pillow.cmd bdist_wheel - cd c:\pillow diff --git a/.ci/after_success.sh b/.ci/after_success.sh index dcf276daa56..762670f101c 100755 --- a/.ci/after_success.sh +++ b/.ci/after_success.sh @@ -12,7 +12,7 @@ if [[ $TRAVIS ]]; then codecov --flags TravisCI fi -if [ "$TRAVIS_PYTHON_VERSION" == "3.8" ]; then +if [ "$TRAVIS_PYTHON_VERSION" == "3.9" ]; then # Coverage and quality reports on just the latest diff. depends/diffcover-install.sh depends/diffcover-run.sh diff --git a/.ci/install.sh b/.ci/install.sh index 8e1e263e175..77dccaa4ab3 100755 --- a/.ci/install.sh +++ b/.ci/install.sh @@ -21,35 +21,35 @@ sudo apt-get -qq install libfreetype6-dev liblcms2-dev python3-tk\ ghostscript libffi-dev libjpeg-turbo-progs libopenjp2-7-dev\ cmake imagemagick libharfbuzz-dev libfribidi-dev -if [[ $TRAVIS_CPU_ARCH == "s390x" || $TRAVIS_CPU_ARCH == "ppc64le" ]]; then sudo chown $USER ~/.cache/pip/wheels ; fi +if [[ $TRAVIS_CPU_ARCH == "s390x" ]]; then sudo chown $USER ~/.cache/pip/wheels ; fi -pip install --upgrade pip -PYTHONOPTIMIZE=0 pip install cffi -pip install coverage -pip install olefile -pip install -U pytest -pip install -U pytest-cov -pip install pyroma -pip install test-image-results +python3 -m pip install --upgrade pip +PYTHONOPTIMIZE=0 python3 -m pip install cffi +python3 -m pip install coverage +python3 -m pip install olefile +python3 -m pip install -U pytest +python3 -m pip install -U pytest-cov +python3 -m pip install pyroma +python3 -m pip install test-image-results # TODO Remove condition when numpy supports 3.10 -if ! [ "$GHA_PYTHON_VERSION" == "3.10-dev" ]; then pip install numpy ; fi +if ! [ "$GHA_PYTHON_VERSION" == "3.10-dev" ]; then python3 -m pip install numpy ; fi # TODO Remove when 3.8 / 3.9 / PyPy3 includes setuptools 49.3.2+: -if [ "$GHA_PYTHON_VERSION" == "3.8" ]; then pip install -U "setuptools>=49.3.2" ; fi -if [ "$GHA_PYTHON_VERSION" == "3.9" ]; then pip install -U "setuptools>=49.3.2" ; fi -if [ "$TRAVIS_PYTHON_VERSION" == "pypy3.6-7.3.1" ]; then pip install -U "setuptools>=49.3.2" ; fi +if [ "$GHA_PYTHON_VERSION" == "3.8" ]; then python3 -m pip install -U "setuptools>=49.3.2" ; fi +if [ "$GHA_PYTHON_VERSION" == "3.9" ]; then python3 -m pip install -U "setuptools>=49.3.2" ; fi +if [ "$TRAVIS_PYTHON_VERSION" == "pypy3.6-7.3.1" ]; then python3 -m pip install -U "setuptools>=49.3.2" ; fi if [[ $TRAVIS_PYTHON_VERSION == 3.* ]]; then # arm64, ppc64le, s390x CPUs: # "ERROR: Could not find a version that satisfies the requirement pyqt5" if [[ $TRAVIS_CPU_ARCH == "amd64" ]]; then sudo apt-get -qq install libxcb-xinerama0 pyqt5-dev-tools - pip install pyqt5 + python3 -m pip install pyqt5 fi fi -# docs only on Python 3.8 -if [ "$TRAVIS_PYTHON_VERSION" == "3.8" ]; then pip install -r requirements.txt ; fi +# docs only on Python 3.9 +if [ "$TRAVIS_PYTHON_VERSION" == "3.9" ]; then python3 -m pip install -r requirements.txt ; fi # webp pushd depends && ./install_webp.sh && popd diff --git a/.ci/test.sh b/.ci/test.sh index 579372a6288..1396445e0a4 100755 --- a/.ci/test.sh +++ b/.ci/test.sh @@ -5,6 +5,6 @@ set -e python -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term Tests # Docs -if [ "$TRAVIS_PYTHON_VERSION" == "3.8" ] && [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then +if [ "$TRAVIS_PYTHON_VERSION" == "3.9" ] && [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then make doccheck fi diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 3d27b5d88c6..a65487d5ea5 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -9,7 +9,7 @@ Please send a pull request to the master branch. Please include [documentation]( - Fork the Pillow repository. - Create a branch from master. - Develop bug fixes, features, tests, etc. -- Run the test suite. You can enable [Travis CI](https://travis-ci.org/profile/) and [AppVeyor](https://ci.appveyor.com/projects/new) on your repo to catch test failures prior to the pull request, and [Codecov](https://codecov.io/gh) to see if the changed code is covered by tests. +- Run the test suite. You can enable [Travis CI](https://travis-ci.com/account/repositories) and [AppVeyor](https://ci.appveyor.com/projects/new) on your repo to catch test failures prior to the pull request, and [Codecov](https://codecov.io/gh) to see if the changed code is covered by tests. - Create a pull request to pull the changes from your branch to the Pillow master. ### Guidelines @@ -17,7 +17,7 @@ Please send a pull request to the master branch. Please include [documentation]( - Separate code commits from reformatting commits. - Provide tests for any newly added code. - Follow PEP 8. -- When committing only documentation changes please include [ci skip] in the commit message to avoid running tests on Travis-CI and AppVeyor. +- When committing only documentation changes please include `[ci skip]` in the commit message to avoid running tests on Travis CI and AppVeyor. ## Reporting Issues diff --git a/.github/mergify.yml b/.github/mergify.yml index 3683bc483dd..fd4b5271f3d 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -7,8 +7,8 @@ pull_request_rules: - status-success=Test Successful - status-success=Docker Test Successful - status-success=Windows Test Successful + - status-success=Travis CI - Pull Request - status-success=continuous-integration/appveyor/pr - - status-success=continuous-integration/travis-ci/pr actions: merge: method: merge diff --git a/.github/workflows/macos-install.sh b/.github/workflows/macos-install.sh index 4d5e54b2726..fb8869c7dbd 100755 --- a/.github/workflows/macos-install.sh +++ b/.github/workflows/macos-install.sh @@ -4,21 +4,21 @@ set -e brew install libtiff libjpeg openjpeg libimagequant webp little-cms2 freetype openblas -PYTHONOPTIMIZE=0 pip install cffi -pip install coverage -pip install olefile -pip install -U pytest -pip install -U pytest-cov -pip install pyroma -pip install test-image-results +PYTHONOPTIMIZE=0 python3 -m pip install cffi +python3 -m pip install coverage +python3 -m pip install olefile +python3 -m pip install -U pytest +python3 -m pip install -U pytest-cov +python3 -m pip install pyroma +python3 -m pip install test-image-results echo -e "[openblas]\nlibraries = openblas\nlibrary_dirs = /usr/local/opt/openblas/lib" >> ~/.numpy-site.cfg # TODO Remove condition when numpy supports 3.10 -if ! [ "$GHA_PYTHON_VERSION" == "3.10-dev" ]; then pip install numpy ; fi +if ! [ "$GHA_PYTHON_VERSION" == "3.10-dev" ]; then python3 -m pip install numpy ; fi # TODO Remove when 3.8 / 3.9 includes setuptools 49.3.2+: -if [ "$GHA_PYTHON_VERSION" == "3.8" ]; then pip install -U "setuptools>=49.3.2" ; fi -if [ "$GHA_PYTHON_VERSION" == "3.9" ]; then pip install -U "setuptools>=49.3.2" ; fi +if [ "$GHA_PYTHON_VERSION" == "3.8" ]; then python3 -m pip install -U "setuptools>=49.3.2" ; fi +if [ "$GHA_PYTHON_VERSION" == "3.9" ]; then python3 -m pip install -U "setuptools>=49.3.2" ; fi # extra test images pushd depends && ./install_extra_test_images.sh && popd diff --git a/.github/workflows/test-docker.yml b/.github/workflows/test-docker.yml index 322244b12df..ddec1bee499 100644 --- a/.github/workflows/test-docker.yml +++ b/.github/workflows/test-docker.yml @@ -20,8 +20,8 @@ jobs: centos-8-amd64, amazon-1-amd64, amazon-2-amd64, - fedora-31-amd64, fedora-32-amd64, + fedora-33-amd64, ] dockerTag: [master] diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 7c28b5075f7..4d3619edbfb 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -52,15 +52,10 @@ jobs: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.architecture }} - - name: Set up TCL - if: "contains(matrix.python-version, 'pypy')" - run: echo "TCL_LIBRARY=$env:pythonLocation\tcl\tcl8.5" >> $env:GITHUB_ENV - shell: pwsh - - name: Print build system information run: python .github/workflows/system-info.py - - name: pip install wheel pytest pytest-cov + - name: python -m pip install wheel pytest pytest-cov run: python -m pip install wheel pytest pytest-cov # TODO Remove when 3.8 / 3.9 includes setuptools 49.3.2+: @@ -76,7 +71,7 @@ jobs: winbuild\depends\gs9533w32.exe /S echo "C:\Program Files (x86)\gs\gs9.53.3\bin" >> $env:GITHUB_PATH - xcopy /s winbuild\depends\test_images\* Tests\images\ + xcopy /S /Y winbuild\depends\test_images\* Tests\images\ shell: pwsh - name: Cache build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 72291876aae..3da945f3988 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,7 +45,7 @@ jobs: - name: Get pip cache dir id: pip-cache run: | - echo "::set-output name=dir::$(pip cache dir)" + echo "::set-output name=dir::$(python3 -m pip cache dir)" - name: pip cache uses: actions/cache@v2 @@ -95,9 +95,9 @@ jobs: path: Tests/errors - name: Docs - if: startsWith(matrix.os, 'ubuntu') && matrix.python-version == 3.8 + if: startsWith(matrix.os, 'ubuntu') && matrix.python-version == 3.9 run: | - pip install sphinx-removed-in sphinx-rtd-theme + python3 -m pip install sphinx-removed-in sphinx-rtd-theme make doccheck - name: After success diff --git a/.travis.yml b/.travis.yml index b02f054d0c4..2966cdf19fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,8 +28,8 @@ matrix: - python: "pypy3.6-7.3.1" name: "PyPy3 Xenial" - - python: "3.9-dev" - name: "3.9-dev Xenial" + - python: "3.9" + name: "3.9 Xenial" services: xvfb - python: "3.8" name: "3.8 Xenial" @@ -43,13 +43,10 @@ matrix: env: PYTHONOPTIMIZE=1 services: xvfb - allow_failures: - - python: "3.9-dev" - install: - | if [ "$LINT" == "true" ]; then - pip install tox + python3 -m pip install tox else .ci/install.sh; fi diff --git a/CHANGES.rst b/CHANGES.rst index 57b500aa395..e7090219f95 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,21 @@ Changelog (Pillow) ================== +8.1.0 (unreleased) +------------------ + +- Support raw rgba8888 for DDS #4760 + [qiankanglai] + +8.0.1 (2020-10-22) +------------------ + +- Update FreeType used in binary wheels to 2.10.4 to fix CVE-2020-15999. + [radarhere] + +- Moved string_dimension image to pillow-depends #4993 + [radarhere] + 8.0.0 (2020-10-15) ------------------ diff --git a/Makefile b/Makefile index 4fd031b697c..99232cac9ef 100644 --- a/Makefile +++ b/Makefile @@ -91,6 +91,8 @@ release-test: python3 selftest.py python3 -m pytest Tests python3 setup.py install + -rm dist/*.egg + -rmdir dist python3 -m pytest -qq check-manifest pyroma . diff --git a/README.md b/README.md index 0e6fa1157de..9ead486a0e9 100644 --- a/README.md +++ b/README.md @@ -24,12 +24,12 @@ As of 2019, Pillow development is tests - Travis CI build status (Linux) - + Travis CI build status (macOS) + src="https://img.shields.io/travis/com/python-pillow/pillow-wheels/master.svg?label=macOS%20build"> AppVeyor CI build status (Windows) diff --git a/RELEASING.md b/RELEASING.md index c9a0439d809..dac0ba731de 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -6,10 +6,7 @@ Released quarterly on January 2nd, April 1st, July 1st and October 15th. * [ ] Open a release ticket e.g. https://github.com/python-pillow/Pillow/issues/3154 * [ ] Develop and prepare release in `master` branch. -* [ ] Check [GitHub Actions](https://github.com/python-pillow/Pillow/actions), - [Travis CI](https://travis-ci.org/github/python-pillow/Pillow) and - [AppVeyor](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm - passing tests in `master` branch. +* [ ] Check [GitHub Actions](https://github.com/python-pillow/Pillow/actions), [Travis CI](https://travis-ci.com/github/python-pillow/Pillow) and [AppVeyor](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm passing tests in `master` branch. * [ ] Check that all of the wheel builds [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels) pass the tests in Travis CI. * [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), update version identifier in `src/PIL/_version.py` * [ ] Update `CHANGES.rst`. @@ -40,14 +37,11 @@ Released as needed for security, installation or critical bug fixes. ```bash git checkout -t remotes/origin/5.2.x ``` -* [ ] Cherry pick individual commits from `master` branch to release branch e.g. `5.2.x`. +* [ ] Cherry pick individual commits from `master` branch to release branch e.g. `5.2.x`, then `git push`. -* [ ] Check [GitHub Actions](https://github.com/python-pillow/Pillow/actions), - [Travis CI](https://travis-ci.org/github/python-pillow/Pillow) and - [AppVeyor](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm - passing tests in release branch e.g. `5.2.x`. +* [ ] Check [GitHub Actions](https://github.com/python-pillow/Pillow/actions), [Travis CI](https://travis-ci.com/github/python-pillow/Pillow) and [AppVeyor](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm passing tests in release branch e.g. `5.2.x`. * [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), update version identifier in `src/PIL/_version.py` * [ ] Run pre-release check via `make release-test`. * [ ] Create tag for release e.g.: diff --git a/Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.dds b/Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.dds new file mode 100644 index 00000000000..1da9293de9b Binary files /dev/null and b/Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.dds differ diff --git a/Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.png b/Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.png new file mode 100644 index 00000000000..57177fe2bb8 Binary files /dev/null and b/Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.png differ diff --git a/Tests/images/argb-32bpp_MipMaps-1.dds b/Tests/images/argb-32bpp_MipMaps-1.dds new file mode 100644 index 00000000000..d1d1998b1b3 Binary files /dev/null and b/Tests/images/argb-32bpp_MipMaps-1.dds differ diff --git a/Tests/images/argb-32bpp_MipMaps-1.png b/Tests/images/argb-32bpp_MipMaps-1.png new file mode 100644 index 00000000000..3570ccf355e Binary files /dev/null and b/Tests/images/argb-32bpp_MipMaps-1.png differ diff --git a/Tests/images/string_dimension.tiff b/Tests/images/string_dimension.tiff deleted file mode 100644 index d0b55830128..00000000000 Binary files a/Tests/images/string_dimension.tiff and /dev/null differ diff --git a/Tests/test_file_dds.py b/Tests/test_file_dds.py index 0aec9ea37d0..1cd7a1be75c 100644 --- a/Tests/test_file_dds.py +++ b/Tests/test_file_dds.py @@ -12,6 +12,8 @@ TEST_FILE_DXT5 = "Tests/images/dxt5-argb-8bbp-interpolatedalpha_MipMaps-1.dds" TEST_FILE_DX10_BC7 = "Tests/images/bc7-argb-8bpp_MipMaps-1.dds" TEST_FILE_DX10_BC7_UNORM_SRGB = "Tests/images/DXGI_FORMAT_BC7_UNORM_SRGB.dds" +TEST_FILE_DX10_R8G8B8A8 = "Tests/images/argb-32bpp_MipMaps-1.dds" +TEST_FILE_DX10_R8G8B8A8_UNORM_SRGB = "Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.dds" TEST_FILE_UNCOMPRESSED_RGB = "Tests/images/uncompressed_rgb.dds" @@ -88,6 +90,37 @@ def test_dx10_bc7_unorm_srgb(): assert_image_equal(target, im) +def test_dx10_r8g8b8a8(): + """Check DX10 images can be opened""" + + with Image.open(TEST_FILE_DX10_R8G8B8A8) as im: + im.load() + + assert im.format == "DDS" + assert im.mode == "RGBA" + assert im.size == (256, 256) + + with Image.open(TEST_FILE_DX10_R8G8B8A8.replace(".dds", ".png")) as target: + assert_image_equal(target, im) + + +def test_dx10_r8g8b8a8_unorm_srgb(): + """Check DX10 unsigned normalized integer images can be opened""" + + with Image.open(TEST_FILE_DX10_R8G8B8A8_UNORM_SRGB) as im: + im.load() + + assert im.format == "DDS" + assert im.mode == "RGBA" + assert im.size == (16, 16) + assert im.info["gamma"] == 1 / 2.2 + + with Image.open( + TEST_FILE_DX10_R8G8B8A8_UNORM_SRGB.replace(".dds", ".png") + ) as target: + assert_image_equal(target, im) + + def test_unimplemented_dxgi_format(): with pytest.raises(NotImplementedError): Image.open("Tests/images/unimplemented_dxgi_format.dds") diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index bcffecd3536..f644ef8870e 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -598,6 +598,10 @@ def test_close_on_load_nonexclusive(self, tmp_path): # Ignore this UserWarning which triggers for four tags: # "Possibly corrupt EXIF data. Expecting to read 50404352 bytes but..." @pytest.mark.filterwarnings("ignore:Possibly corrupt EXIF data") + @pytest.mark.skipif( + not os.path.exists("Tests/images/string_dimension.tiff"), + reason="Extra image files not installed", + ) def test_string_dimension(self): # Assert that an error is raised if one of the dimensions is a string with pytest.raises(ValueError): diff --git a/depends/diffcover-install.sh b/depends/diffcover-install.sh index a0b462b56d7..18be4f9f9d1 100755 --- a/depends/diffcover-install.sh +++ b/depends/diffcover-install.sh @@ -5,4 +5,4 @@ git fetch origin master:refs/remotes/origin/master # CFLAGS=-O0 means build with no optimisation. # Makes build much quicker for lxml and other dependencies. -time CFLAGS=-O0 pip install diff_cover +time CFLAGS=-O0 python3 -m pip install diff_cover diff --git a/depends/install_imagequant.sh b/depends/install_imagequant.sh index 1f2b677fde9..ae70bde8fd1 100755 --- a/depends/install_imagequant.sh +++ b/depends/install_imagequant.sh @@ -1,7 +1,7 @@ #!/bin/bash # install libimagequant -archive=libimagequant-2.12.6 +archive=libimagequant-2.13.0 ./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/master/$archive.tar.gz diff --git a/docs/about.rst b/docs/about.rst index 283135aca82..e2bd75561d4 100644 --- a/docs/about.rst +++ b/docs/about.rst @@ -10,7 +10,7 @@ The fork author's goal is to foster and support active development of PIL throug - Publicized development activity on `GitHub`_ - Regular releases to the `Python Package Index`_ -.. _Travis CI: https://travis-ci.org/python-pillow/Pillow +.. _Travis CI: https://travis-ci.com/github/python-pillow/Pillow .. _AppVeyor: https://ci.appveyor.com/project/Python-pillow/pillow .. _GitHub Actions: https://github.com/python-pillow/Pillow/actions .. _GitHub: https://github.com/python-pillow/Pillow diff --git a/docs/handbook/image-file-formats.rst b/docs/handbook/image-file-formats.rst index 5ed72ac1a60..2b6f9483b06 100644 --- a/docs/handbook/image-file-formats.rst +++ b/docs/handbook/image-file-formats.rst @@ -561,8 +561,8 @@ The :py:meth:`~PIL.Image.Image.save` method supports the following options: .. note:: To enable PNG support, you need to build and install the ZLIB compression - library before building the Python Imaging Library. See the `installation - documentation <../installation.html>`_ for details. + library before building the Python Imaging Library. See the + :doc:`installation documentation <../installation>` for details. .. _apng-sequences: @@ -947,9 +947,10 @@ Saving sequences library is v0.5.0 or later. You can check webp animation support at runtime by calling ``features.check("webp_anim")``. -When calling :py:meth:`~PIL.Image.Image.save` to write a WebP file, the -following options are available when the ``save_all`` argument is present and -true. +When calling :py:meth:`~PIL.Image.Image.save` to write a WebP file, by default +only the first frame of a multiframe image will be saved. If the ``save_all`` +argument is present and true, then all frames will be saved, and the following +options will also be available. **append_images** A list of images to append as additional frames. Each of the diff --git a/docs/index.rst b/docs/index.rst index fb59a6c009b..eafcb1fec60 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,12 +9,12 @@ Pillow for enterprise is available via the Tidelift Subscription. `Learn more `_ for further details. This feature is -tested and works on Unix and Mac, but has not yet been built on Windows -platforms. +dependencies: harfbuzz, fribidi, and raqm. See the :doc:`install documentation +<../installation>` for further details. This feature is tested and works on +Unix and Mac, but has not yet been built on Windows platforms. New Optional Parameters ======================= diff --git a/docs/releasenotes/6.0.0.rst b/docs/releasenotes/6.0.0.rst index 0145347f229..3e3b945a0a9 100644 --- a/docs/releasenotes/6.0.0.rst +++ b/docs/releasenotes/6.0.0.rst @@ -17,7 +17,7 @@ Removed deprecated PIL.OleFileIO PIL.OleFileIO was removed as a vendored file and in Pillow 4.0.0 (2017-01) in favour of the upstream olefile Python package, and replaced with an ``ImportError``. The deprecated file has now been removed from Pillow. If needed, install from PyPI (eg. -``pip install olefile``). +``python3 -m pip install olefile``). Removed deprecated ImageOps functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/releasenotes/8.0.1.rst b/docs/releasenotes/8.0.1.rst new file mode 100644 index 00000000000..e50596e5c39 --- /dev/null +++ b/docs/releasenotes/8.0.1.rst @@ -0,0 +1,25 @@ +8.0.1 +----- + +Security +======== + +Update FreeType used in binary wheels to `2.10.4`_ to fix CVE-2020-15999_: + + - A heap buffer overflow has been found in the handling of embedded PNG bitmaps, + introduced in FreeType version 2.6. + + https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15999 + + If you use option ``FT_CONFIG_OPTION_USE_PNG`` you should upgrade immediately. + +We strongly recommend updating to Pillow 8.0.1 if you are using Pillow 8.0.0, which improved support for bitmap fonts. + +In Pillow 7.2.0 and earlier bitmap fonts were disabled with ``FT_LOAD_NO_BITMAP``, but it is not +clear if this prevents the exploit and we recommend updating to Pillow 8.0.1. + +Pillow 8.0.0 and earlier are potentially vulnerable releases, including the last release +to support Python 2.7, namely Pillow 6.2.2. + +.. _2.10.4: https://sourceforge.net/projects/freetype/files/freetype2/2.10.4/ +.. _CVE-2020-15999: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15999 diff --git a/docs/releasenotes/index.rst b/docs/releasenotes/index.rst index ba81fbaf814..5c74bed9b93 100644 --- a/docs/releasenotes/index.rst +++ b/docs/releasenotes/index.rst @@ -13,6 +13,7 @@ expected to be backported to earlier versions. .. toctree:: :maxdepth: 2 + 8.0.1 8.0.0 7.2.0 7.1.2 diff --git a/src/PIL/DdsImagePlugin.py b/src/PIL/DdsImagePlugin.py index 3837192ab29..df2d0060c3a 100644 --- a/src/PIL/DdsImagePlugin.py +++ b/src/PIL/DdsImagePlugin.py @@ -94,6 +94,9 @@ # dxgiformat.h +DXGI_FORMAT_R8G8B8A8_TYPELESS = 27 +DXGI_FORMAT_R8G8B8A8_UNORM = 28 +DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29 DXGI_FORMAT_BC7_TYPELESS = 97 DXGI_FORMAT_BC7_UNORM = 98 DXGI_FORMAT_BC7_UNORM_SRGB = 99 @@ -157,6 +160,15 @@ def _open(self): self.pixel_format = "BC7" self.info["gamma"] = 1 / 2.2 n = 7 + elif dxgi_format in ( + DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + ): + self.tile = [("raw", (0, 0) + self.size, 0, ("RGBA", 0, 1))] + if dxgi_format == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: + self.info["gamma"] = 1 / 2.2 + return else: raise NotImplementedError( f"Unimplemented DXGI format {dxgi_format}" diff --git a/tox.ini b/tox.ini index 81c6e19cf7b..2557d5067a8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ # Tox (https://tox.readthedocs.io/en/latest/) is a tool for running tests # in multiple virtualenvs. This configuration file will run the -# test suite on all supported python versions. To use it, "pip install tox" -# and then run "tox" from this directory. +# test suite on all supported python versions. To use it, +# "python3 -m pip install tox" and then run "tox" from this directory. [tox] envlist = diff --git a/winbuild/build.rst b/winbuild/build.rst index ba568a0303d..cd4a45e87b7 100644 --- a/winbuild/build.rst +++ b/winbuild/build.rst @@ -82,7 +82,7 @@ Pillow for the selected version of Python. instead of installing Pillow. You can also use ``winbuild\build\build_pillow.cmd --inplace develop`` to build -and install Pillow in develop mode (instead of ``pip install --editable``). +and install Pillow in develop mode (instead of ``python3 -m pip install --editable``). Testing Pillow -------------- diff --git a/winbuild/build_prepare.py b/winbuild/build_prepare.py index 352c3f76b5b..6c431f4d6ab 100644 --- a/winbuild/build_prepare.py +++ b/winbuild/build_prepare.py @@ -184,9 +184,9 @@ def cmd_msbuild( "libs": [r"libpng16.lib"], }, "freetype": { - "url": "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.3.tar.gz", # noqa: E501 - "filename": "freetype-2.10.3.tar.gz", - "dir": "freetype-2.10.3", + "url": "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.4.tar.gz", # noqa: E501 + "filename": "freetype-2.10.4.tar.gz", + "dir": "freetype-2.10.4", "patch": { r"builds\windows\vc2010\freetype.vcxproj": { # freetype setting is /MD for .dll and /MT for .lib, we need /MD