mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 10:16:17 +03:00
Merge branch 'master' into rm-3.5
This commit is contained in:
parent
1fe4070af6
commit
e0eec1eb56
|
@ -30,7 +30,10 @@ pip install -U pytest-cov
|
|||
pip install pyroma
|
||||
pip install test-image-results
|
||||
pip install numpy
|
||||
if [ "$TRAVIS_PYTHON_VERSION" == "3.9-dev" ]; then pip install setuptools==47.3.1 ; fi
|
||||
|
||||
# TODO Remove when 3.9-dev includes setuptools 49.3.2+:
|
||||
if [ "$GHA_PYTHON_VERSION" == "3.9-dev" ]; then 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"
|
||||
|
|
3
.github/workflows/macos-install.sh
vendored
3
.github/workflows/macos-install.sh
vendored
|
@ -15,5 +15,8 @@ pip install test-image-results
|
|||
echo -e "[openblas]\nlibraries = openblas\nlibrary_dirs = /usr/local/opt/openblas/lib" >> ~/.numpy-site.cfg
|
||||
pip install numpy
|
||||
|
||||
# TODO Remove when 3.9-dev includes setuptools 49.3.2+:
|
||||
if [ "$GHA_PYTHON_VERSION" == "3.9-dev" ]; then pip install -U "setuptools>=49.3.2" ; fi
|
||||
|
||||
# extra test images
|
||||
pushd depends && ./install_extra_test_images.sh && popd
|
||||
|
|
76
.github/workflows/test-windows.yml
vendored
76
.github/workflows/test-windows.yml
vendored
|
@ -63,7 +63,12 @@ jobs:
|
|||
- name: pip install wheel pytest pytest-cov
|
||||
run: python -m pip install wheel pytest pytest-cov
|
||||
|
||||
- name: Prepare dependencies
|
||||
# TODO Remove when 3.9-dev includes setuptools 49.3.2+:
|
||||
- name: Upgrade setuptools
|
||||
if: "contains(matrix.python-version, '3.9-dev')"
|
||||
run: python -m pip install -U "setuptools>=49.3.2"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
7z x winbuild\depends\nasm-2.14.02-win64.zip "-o$env:RUNNER_WORKSPACE\"
|
||||
Write-Host "::add-path::$env:RUNNER_WORKSPACE\nasm-2.14.02"
|
||||
|
@ -72,41 +77,71 @@ jobs:
|
|||
Write-Host "::add-path::C:\Program Files (x86)\gs\gs9.50\bin"
|
||||
|
||||
xcopy /s winbuild\depends\test_images\* Tests\images\
|
||||
shell: pwsh
|
||||
|
||||
& python.exe winbuild\build_prepare.py -v --python=$env:pythonLocation
|
||||
- name: Cache build
|
||||
id: build-cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: winbuild\build
|
||||
key:
|
||||
${{ hashFiles('winbuild\build_prepare.py') }}-${{ hashFiles('.github\workflows\test-windows.yml') }}-${{ env.pythonLocation }}
|
||||
|
||||
- name: Prepare build
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
& python.exe winbuild\build_prepare.py -v --python=$env:pythonLocation --srcdir
|
||||
shell: pwsh
|
||||
|
||||
- name: Build dependencies / libjpeg-turbo
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_libjpeg.cmd"
|
||||
- name: Build dependencies / zlib
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_zlib.cmd"
|
||||
- name: Build dependencies / LibTiff
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_libtiff.cmd"
|
||||
- name: Build dependencies / WebP
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_libwebp.cmd"
|
||||
- name: Build dependencies / FreeType
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_freetype.cmd"
|
||||
- name: Build dependencies / LCMS2
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_lcms2.cmd"
|
||||
- name: Build dependencies / OpenJPEG
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_openjpeg.cmd"
|
||||
|
||||
# GPL licensed; skip if building wheels
|
||||
# GPL licensed
|
||||
- name: Build dependencies / libimagequant
|
||||
if: "github.event_name != 'push'"
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_libimagequant.cmd"
|
||||
|
||||
# Raqm dependencies
|
||||
- name: Build dependencies / HarfBuzz
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_harfbuzz.cmd"
|
||||
- name: Build dependencies / FriBidi
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_fribidi.cmd"
|
||||
- name: Build dependencies / Raqm
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_libraqm.cmd"
|
||||
|
||||
# trim ~150MB x 9
|
||||
- name: Optimize build cache
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: rmdir /S /Q winbuild\build\src
|
||||
shell: cmd
|
||||
|
||||
- name: Build Pillow
|
||||
run: |
|
||||
& winbuild\build\build_pillow.cmd install
|
||||
$FLAGS=""
|
||||
if ('${{ github.event_name }}' -eq 'push') { $FLAGS="--disable-imagequant" }
|
||||
& winbuild\build\build_pillow.cmd $FLAGS install
|
||||
& $env:pythonLocation\python.exe selftest.py --installed
|
||||
shell: pwsh
|
||||
|
||||
|
@ -151,7 +186,7 @@ jobs:
|
|||
if: "github.event_name == 'push'"
|
||||
run: |
|
||||
for /f "tokens=3 delims=/" %%a in ("${{ github.ref }}") do echo ::set-output name=dist::dist-%%a
|
||||
winbuild\\build\\build_pillow.cmd bdist_wheel"
|
||||
winbuild\\build\\build_pillow.cmd --disable-imagequant bdist_wheel
|
||||
shell: cmd
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
|
@ -169,8 +204,10 @@ jobs:
|
|||
mingw: ["MINGW32", "MINGW64"]
|
||||
include:
|
||||
- mingw: "MINGW32"
|
||||
name: "MSYS2 MinGW 32-bit"
|
||||
package: "mingw-w64-i686"
|
||||
- mingw: "MINGW64"
|
||||
name: "MSYS2 MinGW 64-bit"
|
||||
package: "mingw-w64-x86_64"
|
||||
|
||||
defaults:
|
||||
|
@ -181,7 +218,7 @@ jobs:
|
|||
CHERE_INVOKING: 1
|
||||
|
||||
timeout-minutes: 30
|
||||
name: MSYS2 ${{ matrix.mingw }}
|
||||
name: ${{ matrix.name }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -193,23 +230,22 @@ jobs:
|
|||
- name: Install Dependencies
|
||||
run: |
|
||||
pacman -S --noconfirm \
|
||||
${{ matrix.package }}-python3-cffi \
|
||||
${{ matrix.package }}-python3-numpy \
|
||||
${{ matrix.package }}-python3-olefile \
|
||||
${{ matrix.package }}-python3-pip \
|
||||
${{ matrix.package }}-python3-setuptools \
|
||||
${{ matrix.package }}-python3-pyqt5 \
|
||||
${{ matrix.package }}-python3-pytest \
|
||||
${{ matrix.package }}-python3-pytest-cov \
|
||||
${{ matrix.package }}-python3-cffi \
|
||||
${{ matrix.package }}-python3-olefile \
|
||||
${{ matrix.package }}-python3-numpy \
|
||||
${{ matrix.package }}-python3-pyqt5 \
|
||||
${{ matrix.package }}-python3-numpy \
|
||||
${{ matrix.package }}-python3-setuptools \
|
||||
${{ matrix.package }}-freetype \
|
||||
${{ matrix.package }}-lcms2 \
|
||||
${{ matrix.package }}-libwebp \
|
||||
${{ matrix.package }}-libjpeg-turbo \
|
||||
${{ matrix.package }}-openjpeg2 \
|
||||
${{ matrix.package }}-libimagequant \
|
||||
${{ matrix.package }}-libraqm \
|
||||
${{ matrix.package }}-ghostscript \
|
||||
${{ matrix.package }}-lcms2 \
|
||||
${{ matrix.package }}-libimagequant \
|
||||
${{ matrix.package }}-libjpeg-turbo \
|
||||
${{ matrix.package }}-libraqm \
|
||||
${{ matrix.package }}-libwebp \
|
||||
${{ matrix.package }}-openjpeg2 \
|
||||
subversion
|
||||
|
||||
python3 -m pip install pyroma
|
||||
|
@ -231,4 +267,4 @@ jobs:
|
|||
python3 -m pip install codecov
|
||||
bash <(curl -s https://codecov.io/bash) -F GHA_Windows
|
||||
env:
|
||||
CODECOV_NAME: MSYS2 ${{ matrix.mingw }}
|
||||
CODECOV_NAME: ${{ matrix.name }}
|
||||
|
|
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
|
@ -62,11 +62,15 @@ jobs:
|
|||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: |
|
||||
.ci/install.sh
|
||||
env:
|
||||
GHA_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install macOS dependencies
|
||||
if: startsWith(matrix.os, 'macOS')
|
||||
run: |
|
||||
.github/workflows/macos-install.sh
|
||||
env:
|
||||
GHA_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 6bedb5c58a7d8c25aa9509f8217bc24e9797e90d # frozen: 19.10b0
|
||||
rev: e66be67b9b6811913470f70c28b4d50f94d05b22 # frozen: 20.8b1
|
||||
hooks:
|
||||
- id: black
|
||||
args: ["--target-version", "py36"]
|
||||
|
@ -9,35 +9,35 @@ repos:
|
|||
types: []
|
||||
|
||||
- repo: https://github.com/timothycrosley/isort
|
||||
rev: 7c29dd9d55161704cfc45998c6f5c2c43d39264b # frozen: 4.3.21
|
||||
rev: 377d260ffa6f746693f97b46d95025afc4bd8275 # frozen: 5.4.2
|
||||
hooks:
|
||||
- id: isort
|
||||
|
||||
- repo: https://github.com/asottile/yesqa
|
||||
rev: b13a51aa54142c59219c764e9f9362c049b439ed # frozen: v1.2.0
|
||||
rev: 7a009f3ee493c796827ee334f9058b110a0e0db8 # frozen: v1.2.1
|
||||
hooks:
|
||||
- id: yesqa
|
||||
|
||||
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
||||
rev: ffbd448645bad2e7ca13f96fca5830058d27ccd5 # frozen: v1.1.7
|
||||
rev: f30f4974a08a6b2f6a1eeaf30a4d501cf909163a # frozen: v1.1.9
|
||||
hooks:
|
||||
- id: remove-tabs
|
||||
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.opt$)
|
||||
|
||||
- repo: https://gitlab.com/pycqa/flake8
|
||||
rev: 735cfe7e1c57a8e05f660ba75de72313005af54a # frozen: 3.8.2
|
||||
rev: 05f6544aef321e2fee03a1277ce2eef8880fb927 # frozen: 3.8.3
|
||||
hooks:
|
||||
- id: flake8
|
||||
additional_dependencies: [flake8-2020, flake8-implicit-str-concat]
|
||||
|
||||
- repo: https://github.com/pre-commit/pygrep-hooks
|
||||
rev: 0d7d077d6ed5624854f93ac601739c1804ebeb98 # frozen: v1.5.1
|
||||
rev: eae6397e4c259ed3d057511f6dd5330b92867e62 # frozen: v1.6.0
|
||||
hooks:
|
||||
- id: python-check-blanket-noqa
|
||||
- id: rst-backticks
|
||||
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: ebc15addedad713c86ef18ae9632c88e187dd0af # frozen: v3.1.0
|
||||
rev: e1668fe86af3810fbca72b8653fe478e66a0afdc # frozen: v3.2.0
|
||||
hooks:
|
||||
- id: check-merge-conflict
|
||||
- id: check-yaml
|
||||
|
|
24
CHANGES.rst
24
CHANGES.rst
|
@ -5,9 +5,33 @@ Changelog (Pillow)
|
|||
8.0.0 (unreleased)
|
||||
------------------
|
||||
|
||||
- Fix IFDRational __eq__ bug #4888
|
||||
[luphord, radarhere]
|
||||
|
||||
- Fixed duplicate variable name #4885
|
||||
[liZe, radarhere]
|
||||
|
||||
- Added homebrew zlib include directory #4842
|
||||
[radarhere]
|
||||
|
||||
- Corrected inverted PDF CMYK colors #4866
|
||||
[radarhere]
|
||||
|
||||
- Do not try to close file pointer if file pointer is empty #4823
|
||||
[radarhere]
|
||||
|
||||
- ImageOps.autocontrast: add mask parameter #4843
|
||||
[navneeth, hugovk]
|
||||
|
||||
- Read EXIF data tEXt chunk into info as bytes instead of string #4828
|
||||
[radarhere]
|
||||
|
||||
- Remove long-deprecated Image.py functions #4798
|
||||
[hugovk, nulano, radarhere]
|
||||
|
||||
- Replaced most uses of distutils with setuptools #4797, #4809, #4814, #4817, #4829
|
||||
[hugovk, radarhere]
|
||||
|
||||
- Add MIME type to PsdImagePlugin #4788
|
||||
[samamorgan]
|
||||
|
||||
|
|
30
Makefile
30
Makefile
|
@ -1,7 +1,6 @@
|
|||
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
|
||||
.PHONY: clean coverage doc docserve help inplace install install-req release-test sdist test upload upload-test
|
||||
.DEFAULT_GOAL := release-test
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
python3 setup.py clean
|
||||
rm src/PIL/*.so || true
|
||||
|
@ -9,28 +8,34 @@ clean:
|
|||
find . -name __pycache__ | xargs rm -r || true
|
||||
|
||||
BRANCHES=`git branch -a | grep -v HEAD | grep -v master | grep remote`
|
||||
.PHONY: co
|
||||
co:
|
||||
-for i in $(BRANCHES) ; do \
|
||||
git checkout -t $$i ; \
|
||||
done
|
||||
|
||||
.PHONY: coverage
|
||||
coverage:
|
||||
pytest -qq
|
||||
rm -r htmlcov || true
|
||||
coverage report
|
||||
|
||||
.PHONY: doc
|
||||
doc:
|
||||
$(MAKE) -C docs html
|
||||
|
||||
.PHONY: doccheck
|
||||
doccheck:
|
||||
$(MAKE) -C docs html
|
||||
# Don't make our tests rely on the links in the docs being up every single build.
|
||||
# We don't control them. But do check, and update them to the target of their redirects.
|
||||
$(MAKE) -C docs linkcheck || true
|
||||
|
||||
.PHONY: docserve
|
||||
docserve:
|
||||
cd docs/_build/html && python3 -mSimpleHTTPServer 2> /dev/null&
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "Welcome to Pillow development. Please use \`make <target>\` where <target> is one of"
|
||||
@echo " clean remove build products"
|
||||
|
@ -48,17 +53,21 @@ help:
|
|||
@echo " upload build and upload sdists to PyPI"
|
||||
@echo " upload-test build and upload sdists to test.pythonpackages.com"
|
||||
|
||||
.PHONY: inplace
|
||||
inplace: clean
|
||||
python3 setup.py develop build_ext --inplace
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
python3 setup.py install
|
||||
python3 selftest.py
|
||||
|
||||
.PHONY: install-coverage
|
||||
install-coverage:
|
||||
CFLAGS="-coverage" python3 setup.py build_ext install
|
||||
python3 selftest.py
|
||||
|
||||
.PHONY: debug
|
||||
debug:
|
||||
# make a debug version if we don't have a -dbg python. Leaves in symbols
|
||||
# for our stuff, kills optimization, and redirects to dev null so we
|
||||
|
@ -66,13 +75,16 @@ debug:
|
|||
make clean > /dev/null
|
||||
CFLAGS='-g -O0' python3 setup.py build_ext install > /dev/null
|
||||
|
||||
.PHONY: install-req
|
||||
install-req:
|
||||
python3 -m pip install -r requirements.txt
|
||||
|
||||
.PHONY: install-venv
|
||||
install-venv:
|
||||
virtualenv .
|
||||
bin/pip install -r requirements.txt
|
||||
|
||||
.PHONY: release-test
|
||||
release-test:
|
||||
$(MAKE) install-req
|
||||
python3 setup.py develop
|
||||
|
@ -84,22 +96,14 @@ release-test:
|
|||
pyroma .
|
||||
viewdoc
|
||||
|
||||
.PHONY: sdist
|
||||
sdist:
|
||||
python3 setup.py sdist --format=gztar
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
pytest -qq
|
||||
|
||||
# https://docs.python.org/3/distutils/packageindex.html#the-pypirc-file
|
||||
upload-test:
|
||||
# [test]
|
||||
# username:
|
||||
# password:
|
||||
# repository = http://test.pythonpackages.com
|
||||
python3 setup.py sdist --format=gztar upload -r test
|
||||
|
||||
upload:
|
||||
python3 setup.py sdist --format=gztar upload
|
||||
|
||||
.PHONY: readme
|
||||
readme:
|
||||
viewdoc
|
||||
|
|
96
README.md
Normal file
96
README.md
Normal file
|
@ -0,0 +1,96 @@
|
|||
<p align="center">
|
||||
<img width="248" height="250" src="https://raw.githubusercontent.com/python-pillow/pillow-logo/master/pillow-logo-248x250.png" alt="Pillow logo">
|
||||
</p>
|
||||
|
||||
# Pillow
|
||||
|
||||
## Python Imaging Library (Fork)
|
||||
|
||||
Pillow is the friendly PIL fork by [Alex Clark and
|
||||
Contributors](https://github.com/python-pillow/Pillow/graphs/contributors).
|
||||
PIL is the Python Imaging Library by Fredrik Lundh and Contributors.
|
||||
As of 2019, Pillow development is
|
||||
[supported by Tidelift](https://tidelift.com/subscription/pkg/pypi-pillow?utm_source=pypi-pillow&utm_medium=readme&utm_campaign=enterprise).
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>docs</th>
|
||||
<td>
|
||||
<a href="https://pillow.readthedocs.io/?badge=latest"><img
|
||||
alt="Documentation Status"
|
||||
src="https://readthedocs.org/projects/pillow/badge/?version=latest"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>tests</th>
|
||||
<td>
|
||||
<a href="https://travis-ci.org/python-pillow/Pillow"><img
|
||||
alt="Travis CI build status (Linux)"
|
||||
src="https://img.shields.io/travis/python-pillow/Pillow/master.svg?label=Linux%20build"></a>
|
||||
<a href="https://travis-ci.org/python-pillow/pillow-wheels"><img
|
||||
alt="Travis CI build status (macOS)"
|
||||
src="https://img.shields.io/travis/python-pillow/pillow-wheels/master.svg?label=macOS%20build"></a>
|
||||
<a href="https://ci.appveyor.com/project/python-pillow/Pillow"><img
|
||||
alt="AppVeyor CI build status (Windows)"
|
||||
src="https://img.shields.io/appveyor/build/python-pillow/Pillow/master.svg?label=Windows%20build"></a>
|
||||
<a href="https://github.com/python-pillow/Pillow/actions?query=workflow%3ALint"><img
|
||||
alt="GitHub Actions build status (Lint)"
|
||||
src="https://github.com/python-pillow/Pillow/workflows/Lint/badge.svg"></a>
|
||||
<a href="https://github.com/python-pillow/Pillow/actions?query=workflow%3ATest"><img
|
||||
alt="GitHub Actions build status (Test Linux and macOS)"
|
||||
src="https://github.com/python-pillow/Pillow/workflows/Test/badge.svg"></a>
|
||||
<a href="https://github.com/python-pillow/Pillow/actions?query=workflow%3A%22Test+Windows%22"><img
|
||||
alt="GitHub Actions build status (Test Windows)"
|
||||
src="https://github.com/python-pillow/Pillow/workflows/Test%20Windows/badge.svg"></a>
|
||||
<a href="https://github.com/python-pillow/Pillow/actions?query=workflow%3A%22Test+Docker%22"><img
|
||||
alt="GitHub Actions build status (Test Docker)"
|
||||
src="https://github.com/python-pillow/Pillow/workflows/Test%20Docker/badge.svg"></a>
|
||||
<a href="https://codecov.io/gh/python-pillow/Pillow"><img
|
||||
alt="Code coverage"
|
||||
src="https://codecov.io/gh/python-pillow/Pillow/branch/master/graph/badge.svg"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>package</th>
|
||||
<td>
|
||||
<a href="https://zenodo.org/badge/latestdoi/17549/python-pillow/Pillow"><img
|
||||
alt="Zenodo"
|
||||
src="https://zenodo.org/badge/17549/python-pillow/Pillow.svg"></a>
|
||||
<a href="https://tidelift.com/subscription/pkg/pypi-pillow?utm_source=pypi-pillow&utm_medium=badge"><img
|
||||
alt="Tidelift"
|
||||
src="https://tidelift.com/badges/package/pypi/Pillow?style=flat"></a>
|
||||
<a href="https://pypi.org/project/Pillow/"><img
|
||||
alt="Newest PyPI version"
|
||||
src="https://img.shields.io/pypi/v/pillow.svg"></a>
|
||||
<a href="https://pypi.org/project/Pillow/"><img
|
||||
alt="Number of PyPI downloads"
|
||||
src="https://img.shields.io/pypi/dm/pillow.svg"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>social</th>
|
||||
<td>
|
||||
<a href="https://gitter.im/python-pillow/Pillow?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img
|
||||
alt="Join the chat at https://gitter.im/python-pillow/Pillow"
|
||||
src="https://badges.gitter.im/python-pillow/Pillow.svg"></a>
|
||||
<a href="https://twitter.com/PythonPillow"><img
|
||||
alt="Follow on https://twitter.com/PythonPillow"
|
||||
src="https://img.shields.io/badge/tweet-on%20Twitter-00aced.svg"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## More Information
|
||||
|
||||
- [Documentation](https://pillow.readthedocs.io/)
|
||||
- [Installation](https://pillow.readthedocs.io/en/latest/installation.html)
|
||||
- [Handbook](https://pillow.readthedocs.io/en/latest/handbook/index.html)
|
||||
- [Contribute](https://github.com/python-pillow/Pillow/blob/master/.github/CONTRIBUTING.md)
|
||||
- [Issues](https://github.com/python-pillow/Pillow/issues)
|
||||
- [Pull requests](https://github.com/python-pillow/Pillow/pulls)
|
||||
- [Changelog](https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst)
|
||||
- [Pre-fork](https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst#pre-fork)
|
||||
|
||||
## Report a Vulnerability
|
||||
|
||||
To report a security vulnerability, please follow the procedure described in the [Tidelift security policy](https://tidelift.com/docs/security).
|
103
README.rst
103
README.rst
|
@ -1,103 +0,0 @@
|
|||
Pillow
|
||||
======
|
||||
|
||||
Python Imaging Library (Fork)
|
||||
-----------------------------
|
||||
|
||||
Pillow is the friendly PIL fork by `Alex Clark and Contributors <https://github.com/python-pillow/Pillow/graphs/contributors>`_. PIL is the Python Imaging Library by Fredrik Lundh and Contributors. As of 2019, Pillow development is `supported by Tidelift <https://tidelift.com/subscription/pkg/pypi-pillow?utm_source=pypi-pillow&utm_medium=readme&utm_campaign=enterprise>`_.
|
||||
|
||||
.. start-badges
|
||||
|
||||
.. list-table::
|
||||
:stub-columns: 1
|
||||
|
||||
* - docs
|
||||
- |docs|
|
||||
* - tests
|
||||
- |linux| |macos| |windows| |gha_lint| |gha| |gha_windows| |gha_docker| |coverage|
|
||||
* - package
|
||||
- |zenodo| |tidelift| |version| |downloads|
|
||||
* - social
|
||||
- |gitter| |twitter|
|
||||
|
||||
.. end-badges
|
||||
|
||||
More Information
|
||||
----------------
|
||||
|
||||
- `Documentation <https://pillow.readthedocs.io/>`_
|
||||
|
||||
- `Installation <https://pillow.readthedocs.io/en/latest/installation.html>`_
|
||||
- `Handbook <https://pillow.readthedocs.io/en/latest/handbook/index.html>`_
|
||||
|
||||
- `Contribute <https://github.com/python-pillow/Pillow/blob/master/.github/CONTRIBUTING.md>`_
|
||||
|
||||
- `Issues <https://github.com/python-pillow/Pillow/issues>`_
|
||||
- `Pull requests <https://github.com/python-pillow/Pillow/pulls>`_
|
||||
|
||||
- `Changelog <https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst>`_
|
||||
|
||||
- `Pre-fork <https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst#pre-fork>`_
|
||||
|
||||
Report a Vulnerability
|
||||
----------------------
|
||||
|
||||
To report a security vulnerability, please follow the procedure described in the `Tidelift security policy <https://tidelift.com/docs/security>`_.
|
||||
|
||||
.. |docs| image:: https://readthedocs.org/projects/pillow/badge/?version=latest
|
||||
:target: https://pillow.readthedocs.io/?badge=latest
|
||||
:alt: Documentation Status
|
||||
|
||||
.. |linux| image:: https://img.shields.io/travis/python-pillow/Pillow/master.svg?label=Linux%20build
|
||||
:target: https://travis-ci.org/python-pillow/Pillow
|
||||
:alt: Travis CI build status (Linux)
|
||||
|
||||
.. |macos| image:: https://img.shields.io/travis/python-pillow/pillow-wheels/master.svg?label=macOS%20build
|
||||
:target: https://travis-ci.org/python-pillow/pillow-wheels
|
||||
:alt: Travis CI build status (macOS)
|
||||
|
||||
.. |windows| image:: https://img.shields.io/appveyor/build/python-pillow/Pillow/master.svg?label=Windows%20build
|
||||
:target: https://ci.appveyor.com/project/python-pillow/Pillow
|
||||
:alt: AppVeyor CI build status (Windows)
|
||||
|
||||
.. |gha_lint| image:: https://github.com/python-pillow/Pillow/workflows/Lint/badge.svg
|
||||
:target: https://github.com/python-pillow/Pillow/actions?query=workflow%3ALint
|
||||
:alt: GitHub Actions build status (Lint)
|
||||
|
||||
.. |gha_docker| image:: https://github.com/python-pillow/Pillow/workflows/Test%20Docker/badge.svg
|
||||
:target: https://github.com/python-pillow/Pillow/actions?query=workflow%3A%22Test+Docker%22
|
||||
:alt: GitHub Actions build status (Test Docker)
|
||||
|
||||
.. |gha| image:: https://github.com/python-pillow/Pillow/workflows/Test/badge.svg
|
||||
:target: https://github.com/python-pillow/Pillow/actions?query=workflow%3ATest
|
||||
:alt: GitHub Actions build status (Test Linux and macOS)
|
||||
|
||||
.. |gha_windows| image:: https://github.com/python-pillow/Pillow/workflows/Test%20Windows/badge.svg
|
||||
:target: https://github.com/python-pillow/Pillow/actions?query=workflow%3A%22Test+Windows%22
|
||||
:alt: GitHub Actions build status (Test Windows)
|
||||
|
||||
.. |coverage| image:: https://codecov.io/gh/python-pillow/Pillow/branch/master/graph/badge.svg
|
||||
:target: https://codecov.io/gh/python-pillow/Pillow
|
||||
:alt: Code coverage
|
||||
|
||||
.. |zenodo| image:: https://zenodo.org/badge/17549/python-pillow/Pillow.svg
|
||||
:target: https://zenodo.org/badge/latestdoi/17549/python-pillow/Pillow
|
||||
|
||||
.. |tidelift| image:: https://tidelift.com/badges/package/pypi/Pillow?style=flat
|
||||
:target: https://tidelift.com/subscription/pkg/pypi-pillow?utm_source=pypi-pillow&utm_medium=badge
|
||||
|
||||
.. |version| image:: https://img.shields.io/pypi/v/pillow.svg
|
||||
:target: https://pypi.org/project/Pillow/
|
||||
:alt: Latest PyPI version
|
||||
|
||||
.. |downloads| image:: https://img.shields.io/pypi/dm/pillow.svg
|
||||
:target: https://pypi.org/project/Pillow/
|
||||
:alt: Number of PyPI downloads
|
||||
|
||||
.. |gitter| image:: https://badges.gitter.im/python-pillow/Pillow.svg
|
||||
:target: https://gitter.im/python-pillow/Pillow?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
||||
:alt: Join the chat at https://gitter.im/python-pillow/Pillow
|
||||
|
||||
.. |twitter| image:: https://img.shields.io/badge/tweet-on%20Twitter-00aced.svg
|
||||
:target: https://twitter.com/PythonPillow
|
||||
:alt: Follow on https://twitter.com/PythonPillow
|
|
@ -101,11 +101,7 @@ Released as needed privately to individual vendors for critical security-related
|
|||
cd pillow-wheels
|
||||
./update-pillow-tag.sh [[release tag]]
|
||||
```
|
||||
* [ ] Download distributions from the [Pillow Wheel Builder container](http://a365fff413fe338398b6-1c8a9b3114517dc5fe17b7c3f8c63a43.r19.cf2.rackcdn.com/).
|
||||
```bash
|
||||
wget -m -A 'Pillow-<VERSION>-*' \
|
||||
http://a365fff413fe338398b6-1c8a9b3114517dc5fe17b7c3f8c63a43.r19.cf2.rackcdn.com
|
||||
```
|
||||
* [ ] Download wheels from the [Pillow Wheel Builder release](https://github.com/python-pillow/pillow-wheels/releases).
|
||||
|
||||
## Publicize Release
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import is_win32
|
||||
|
@ -11,7 +12,7 @@ pytestmark = pytest.mark.skipif(is_win32(), reason="requires Unix or macOS")
|
|||
|
||||
|
||||
def _get_mem_usage():
|
||||
from resource import getpagesize, getrusage, RUSAGE_SELF
|
||||
from resource import RUSAGE_SELF, getpagesize, getrusage
|
||||
|
||||
mem = getrusage(RUSAGE_SELF).ru_maxrss
|
||||
return mem * getpagesize() / 1024 / 1024
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import is_win32, skip_unless_feature
|
||||
|
@ -18,7 +19,7 @@ pytestmark = [
|
|||
|
||||
|
||||
def test_leak_load():
|
||||
from resource import setrlimit, RLIMIT_AS, RLIMIT_STACK
|
||||
from resource import RLIMIT_AS, RLIMIT_STACK, setrlimit
|
||||
|
||||
setrlimit(RLIMIT_STACK, (stack_size, stack_size))
|
||||
setrlimit(RLIMIT_AS, (mem_limit, mem_limit))
|
||||
|
@ -28,7 +29,7 @@ def test_leak_load():
|
|||
|
||||
|
||||
def test_leak_save():
|
||||
from resource import setrlimit, RLIMIT_AS, RLIMIT_STACK
|
||||
from resource import RLIMIT_AS, RLIMIT_STACK, setrlimit
|
||||
|
||||
setrlimit(RLIMIT_STACK, (stack_size, stack_size))
|
||||
setrlimit(RLIMIT_AS, (mem_limit, mem_limit))
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
||||
|
|
|
@ -119,60 +119,59 @@ def test_qtables_leak():
|
|||
|
||||
def test_exif_leak():
|
||||
"""
|
||||
pre patch:
|
||||
pre patch:
|
||||
|
||||
MB
|
||||
177.1^ #
|
||||
| @@@#
|
||||
| :@@@@@@#
|
||||
| ::::@@@@@@#
|
||||
| ::::::::@@@@@@#
|
||||
| @@::::: ::::@@@@@@#
|
||||
| @@@@ ::::: ::::@@@@@@#
|
||||
| @@@@@@@ ::::: ::::@@@@@@#
|
||||
| @@::@@@@@@@ ::::: ::::@@@@@@#
|
||||
| @@@@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| @@@@@@ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| @@@@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| @::@@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| ::::@: @@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| :@@: : @: @@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| ::@@::@@: : @: @@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| @@::: @ ::@@: : @: @@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| @::@ : : @ ::@@: : @: @@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| :::@: @ : : @ ::@@: : @: @@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| @@@:: @: @ : : @ ::@@: : @: @@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
0 +----------------------------------------------------------------------->Gi
|
||||
0 11.37
|
||||
MB
|
||||
177.1^ #
|
||||
| @@@#
|
||||
| :@@@@@@#
|
||||
| ::::@@@@@@#
|
||||
| ::::::::@@@@@@#
|
||||
| @@::::: ::::@@@@@@#
|
||||
| @@@@ ::::: ::::@@@@@@#
|
||||
| @@@@@@@ ::::: ::::@@@@@@#
|
||||
| @@::@@@@@@@ ::::: ::::@@@@@@#
|
||||
| @@@@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| @@@@@@ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| @@@@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| @::@@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| ::::@: @@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| :@@: : @: @@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| ::@@::@@: : @: @@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| @@::: @ ::@@: : @: @@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| @::@ : : @ ::@@: : @: @@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| :::@: @ : : @ ::@@: : @: @@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
| @@@:: @: @ : : @ ::@@: : @: @@ @@ @@ @ @@ : @@@@@@@ ::::: ::::@@@@@@#
|
||||
0 +----------------------------------------------------------------------->Gi
|
||||
0 11.37
|
||||
|
||||
|
||||
post patch:
|
||||
post patch:
|
||||
|
||||
MB
|
||||
21.06^ ::::::::::::::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| ##::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| # ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| # ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| # ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @@@@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @ @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @ @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @ @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @ @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
0 +----------------------------------------------------------------------->Gi
|
||||
0 11.33
|
||||
|
||||
"""
|
||||
MB
|
||||
21.06^ ::::::::::::::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| ##::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| # ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| # ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| # ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @@@@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @ @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @ @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @ @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
| @ @@@# ::: ::::: : ::::::::::@::::@::::@::::@::::@::::@:::::::::@::::::
|
||||
0 +----------------------------------------------------------------------->Gi
|
||||
0 11.33
|
||||
"""
|
||||
im = hopper("RGB")
|
||||
exif = b"12345678" * 4096
|
||||
|
||||
|
@ -183,31 +182,30 @@ post patch:
|
|||
|
||||
def test_base_save():
|
||||
"""
|
||||
base case:
|
||||
MB
|
||||
20.99^ ::::: :::::::::::::::::::::::::::::::::::::::::::@:::
|
||||
| ##: : ::::::@::::::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @@# : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @@@ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| :@@@@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| :@ @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| :@ @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| :@ @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| :@ @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
0 +----------------------------------------------------------------------->Gi
|
||||
0 7.882
|
||||
"""
|
||||
base case:
|
||||
MB
|
||||
20.99^ ::::: :::::::::::::::::::::::::::::::::::::::::::@:::
|
||||
| ##: : ::::::@::::::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @@# : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @@@ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| :@@@@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| :@ @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| :@ @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| :@ @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
| :@ @@ @ # : : :: :: @:: :::: :::: :::: : : : : : : :::::::::::: :::@:::
|
||||
0 +----------------------------------------------------------------------->Gi
|
||||
0 7.882"""
|
||||
im = hopper("RGB")
|
||||
|
||||
for _ in range(iterations):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
# This test is not run automatically.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
# This test is not run automatically.
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
TEST_FILE = "Tests/images/libtiff_segfault.tif"
|
||||
|
||||
|
||||
def test_libtiff_segfault():
|
||||
""" This test should not segfault. It will on Pillow <= 3.1.0 and
|
||||
libtiff >= 4.0.0
|
||||
"""
|
||||
"""This test should not segfault. It will on Pillow <= 3.1.0 and
|
||||
libtiff >= 4.0.0
|
||||
"""
|
||||
|
||||
with pytest.raises(OSError):
|
||||
with Image.open(TEST_FILE) as im:
|
||||
|
|
|
@ -11,6 +11,7 @@ import tempfile
|
|||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageMath, features
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -175,7 +176,7 @@ class PillowLeakTestCase:
|
|||
:returns: memory usage in kilobytes
|
||||
"""
|
||||
|
||||
from resource import getrusage, RUSAGE_SELF
|
||||
from resource import RUSAGE_SELF, getrusage
|
||||
|
||||
mem = getrusage(RUSAGE_SELF).ru_maxrss
|
||||
if sys.platform == "darwin":
|
||||
|
|
BIN
Tests/images/exif_text.png
Normal file
BIN
Tests/images/exif_text.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 174 KiB |
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import assert_image_similar
|
||||
|
@ -15,8 +16,8 @@ def get_files(d, ext=".bmp"):
|
|||
|
||||
|
||||
def test_bad():
|
||||
""" These shouldn't crash/dos, but they shouldn't return anything
|
||||
either """
|
||||
"""These shouldn't crash/dos, but they shouldn't return anything
|
||||
either"""
|
||||
for f in get_files("b"):
|
||||
|
||||
def open(f):
|
||||
|
@ -31,8 +32,8 @@ def test_bad():
|
|||
|
||||
|
||||
def test_questionable():
|
||||
""" These shouldn't crash/dos, but it's not well defined that these
|
||||
are in spec """
|
||||
"""These shouldn't crash/dos, but it's not well defined that these
|
||||
are in spec"""
|
||||
supported = [
|
||||
"pal8os2v2.bmp",
|
||||
"rgb24prof.bmp",
|
||||
|
@ -56,8 +57,8 @@ def test_questionable():
|
|||
|
||||
|
||||
def test_good():
|
||||
""" These should all work. There's a set of target files in the
|
||||
html directory that we can compare against. """
|
||||
"""These should all work. There's a set of target files in the
|
||||
html directory that we can compare against."""
|
||||
|
||||
# Target files, if they're not just replacing the extension
|
||||
file_map = {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, ImageFilter
|
||||
|
||||
sample = Image.new("L", (7, 5))
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from array import array
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageFilter
|
||||
|
||||
from .helper import assert_image_equal
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import is_pypy
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import hopper
|
||||
|
|
|
@ -2,6 +2,7 @@ import io
|
|||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import features
|
||||
|
||||
from .helper import skip_unless_feature
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, ImageSequence, PngImagePlugin
|
||||
|
||||
|
||||
|
@ -358,7 +359,10 @@ def test_apng_save_split_fdat(tmp_path):
|
|||
with Image.open("Tests/images/old-style-jpeg-compression.png") as im:
|
||||
frames = [im.copy(), Image.new("RGBA", im.size, (255, 0, 0, 255))]
|
||||
im.save(
|
||||
test_file, save_all=True, default_image=True, append_images=frames,
|
||||
test_file,
|
||||
save_all=True,
|
||||
default_image=True,
|
||||
append_images=frames,
|
||||
)
|
||||
with Image.open(test_file) as im:
|
||||
exception = None
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import io
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import BmpImagePlugin, Image
|
||||
|
||||
from .helper import assert_image_equal, hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import BufrStubImagePlugin, Image
|
||||
|
||||
from .helper import hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import CurImagePlugin, Image
|
||||
|
||||
TEST_FILE = "Tests/images/deerstalker.cur"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import DcxImagePlugin, Image
|
||||
|
||||
from .helper import assert_image_equal, hopper, is_pypy
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import DdsImagePlugin, Image
|
||||
|
||||
from .helper import assert_image_equal
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import io
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import EpsImagePlugin, Image, features
|
||||
|
||||
from .helper import assert_image_similar, hopper, skip_unless_feature
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import FitsStubImagePlugin, Image
|
||||
|
||||
TEST_FILE = "Tests/images/hopper.fits"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import FliImagePlugin, Image
|
||||
|
||||
from .helper import assert_image_equal, is_pypy
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
FpxImagePlugin = pytest.importorskip(
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import GbrImagePlugin, Image
|
||||
|
||||
from .helper import assert_image_equal
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import GdImageFile, UnidentifiedImageError
|
||||
|
||||
TEST_GD_FILE = "Tests/images/hopper.gd"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import GifImagePlugin, Image, ImageDraw, ImagePalette, features
|
||||
|
||||
from .helper import (
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL.GimpPaletteFile import GimpPaletteFile
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import GribStubImagePlugin, Image
|
||||
|
||||
from .helper import hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Hdf5StubImagePlugin, Image
|
||||
|
||||
TEST_FILE = "Tests/images/hdf5.h5"
|
||||
|
|
|
@ -2,6 +2,7 @@ import io
|
|||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import IcnsImagePlugin, Image, features
|
||||
|
||||
from .helper import assert_image_equal, assert_image_similar
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import io
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import IcoImagePlugin, Image, ImageDraw
|
||||
|
||||
from .helper import assert_image_equal, hopper
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import filecmp
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImImagePlugin
|
||||
|
||||
from .helper import assert_image_equal, hopper, is_pypy
|
||||
|
|
|
@ -3,6 +3,7 @@ import re
|
|||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import (
|
||||
ExifTags,
|
||||
Image,
|
||||
|
@ -38,7 +39,7 @@ class TestFileJpeg:
|
|||
return im
|
||||
|
||||
def gen_random_image(self, size, mode="RGB"):
|
||||
""" Generates a very hard to compress file
|
||||
"""Generates a very hard to compress file
|
||||
:param size: tuple
|
||||
:param mode: optional image mode
|
||||
|
||||
|
@ -98,7 +99,8 @@ class TestFileJpeg:
|
|||
assert k > 0.9
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_image_path", [TEST_FILE, "Tests/images/pil_sample_cmyk.jpg"],
|
||||
"test_image_path",
|
||||
[TEST_FILE, "Tests/images/pil_sample_cmyk.jpg"],
|
||||
)
|
||||
def test_dpi(self, test_image_path):
|
||||
def test(xdpi, ydpi=None):
|
||||
|
@ -241,6 +243,16 @@ class TestFileJpeg:
|
|||
# Assert
|
||||
assert exif[gps_index] == expected_exif_gps
|
||||
|
||||
def test_exif_equality(self):
|
||||
# In 7.2.0, Exif rationals were changed to be read as
|
||||
# TiffImagePlugin.IFDRational. This class had a bug in __eq__,
|
||||
# breaking the self-equality of Exif data
|
||||
exifs = []
|
||||
for i in range(2):
|
||||
with Image.open("Tests/images/exif-200dpcm.jpg") as im:
|
||||
exifs.append(im._getexif())
|
||||
assert exifs[0] == exifs[1]
|
||||
|
||||
def test_exif_rollback(self):
|
||||
# rolling back exif support in 3.1 to pre-3.0 formatting.
|
||||
# expected from 2.9, with b/u qualifiers switched for 3.2 compatibility
|
||||
|
|
|
@ -2,6 +2,7 @@ import re
|
|||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageFile, Jpeg2KImagePlugin, features
|
||||
|
||||
from .helper import (
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import base64
|
||||
import io
|
||||
import itertools
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
from collections import namedtuple
|
||||
from ctypes import c_float
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageFilter, TiffImagePlugin, TiffTags, features
|
||||
|
||||
from .helper import (
|
||||
|
@ -19,8 +19,6 @@ from .helper import (
|
|||
skip_unless_feature,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@skip_unless_feature("libtiff")
|
||||
class LibTiffTestCase:
|
||||
|
@ -404,8 +402,8 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
assert "temp.tif" == reread.tag[269][0]
|
||||
|
||||
def test_12bit_rawmode(self):
|
||||
""" Are we generating the same interpretation
|
||||
of the image as Imagemagick is? """
|
||||
"""Are we generating the same interpretation
|
||||
of the image as Imagemagick is?"""
|
||||
TiffImagePlugin.READ_LIBTIFF = True
|
||||
with Image.open("Tests/images/12bit.cropped.tif") as im:
|
||||
im.load()
|
||||
|
@ -505,9 +503,9 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
assert len(reloaded.tag_v2[320]) == 768
|
||||
|
||||
def xtest_bw_compression_w_rgb(self, tmp_path):
|
||||
""" This test passes, but when running all tests causes a failure due
|
||||
to output on stderr from the error thrown by libtiff. We need to
|
||||
capture that but not now"""
|
||||
"""This test passes, but when running all tests causes a failure due
|
||||
to output on stderr from the error thrown by libtiff. We need to
|
||||
capture that but not now"""
|
||||
|
||||
im = hopper("RGB")
|
||||
out = str(tmp_path / "temp.tif")
|
||||
|
@ -770,7 +768,7 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
assert im.mode == "RGBA"
|
||||
assert im.size == (100, 40)
|
||||
assert im.tile, [
|
||||
("libtiff", (0, 0, 100, 40), 0, ("RGBa;16N", "tiff_lzw", False, 38236),)
|
||||
("libtiff", (0, 0, 100, 40), 0, ("RGBa;16N", "tiff_lzw", False, 38236))
|
||||
]
|
||||
im.load()
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@ from .test_file_libtiff import LibTiffTestCase
|
|||
|
||||
class TestFileLibTiffSmall(LibTiffTestCase):
|
||||
|
||||
""" The small lena image was failing on open in the libtiff
|
||||
decoder because the file pointer was set to the wrong place
|
||||
by a spurious seek. It wasn't failing with the byteio method.
|
||||
"""The small lena image was failing on open in the libtiff
|
||||
decoder because the file pointer was set to the wrong place
|
||||
by a spurious seek. It wasn't failing with the byteio method.
|
||||
|
||||
It was fixed by forcing an lseek to the beginning of the
|
||||
file just before reading in libtiff. These tests remain
|
||||
to ensure that it stays fixed. """
|
||||
It was fixed by forcing an lseek to the beginning of the
|
||||
file just before reading in libtiff. These tests remain
|
||||
to ensure that it stays fixed."""
|
||||
|
||||
def test_g4_hopper_file(self, tmp_path):
|
||||
"""Testing the open file load path"""
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, McIdasImagePlugin
|
||||
|
||||
from .helper import assert_image_equal
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, ImagePalette
|
||||
|
||||
from .helper import assert_image_similar, hopper, skip_unless_feature
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import assert_image_similar, is_pypy, skip_unless_feature
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, MspImagePlugin
|
||||
|
||||
from .helper import assert_image_equal, hopper
|
||||
|
|
|
@ -2,6 +2,7 @@ import os.path
|
|||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import IMCONVERT, assert_image_equal, hopper, imagemagick_available
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, ImageFile, PcxImagePlugin
|
||||
|
||||
from .helper import assert_image_equal, hopper
|
||||
|
|
|
@ -5,6 +5,7 @@ import tempfile
|
|||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, PdfParser
|
||||
|
||||
from .helper import hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, PixarImagePlugin
|
||||
|
||||
from .helper import assert_image_similar, hopper
|
||||
|
|
|
@ -3,6 +3,7 @@ import zlib
|
|||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageFile, PngImagePlugin, features
|
||||
|
||||
from .helper import (
|
||||
|
@ -606,6 +607,11 @@ class TestFilePng:
|
|||
exif = im.copy().getexif()
|
||||
assert exif[274] == 1
|
||||
|
||||
# With a tEXt chunk
|
||||
with Image.open("Tests/images/exif_text.png") as im:
|
||||
exif = im._getexif()
|
||||
assert exif[274] == 1
|
||||
|
||||
# With XMP tags
|
||||
with Image.open("Tests/images/xmp_tags_orientation.png") as im:
|
||||
exif = im.getexif()
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import assert_image_equal, assert_image_similar, hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, PsdImagePlugin
|
||||
|
||||
from .helper import assert_image_similar, hopper, is_pypy
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, SgiImagePlugin
|
||||
|
||||
from .helper import assert_image_equal, assert_image_similar, hopper
|
||||
|
|
|
@ -2,6 +2,7 @@ import tempfile
|
|||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageSequence, SpiderImagePlugin
|
||||
|
||||
from .helper import assert_image_equal, hopper, is_pypy
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, SunImagePlugin
|
||||
|
||||
from .helper import assert_image_equal, assert_image_similar, hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, TarIO, features
|
||||
|
||||
from .helper import is_pypy
|
||||
|
|
|
@ -3,6 +3,7 @@ from glob import glob
|
|||
from itertools import product
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import assert_image_equal, hopper
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import logging
|
||||
import os
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, TiffImagePlugin
|
||||
from PIL.TiffImagePlugin import RESOLUTION_UNIT, X_RESOLUTION, Y_RESOLUTION
|
||||
|
||||
|
@ -16,8 +16,6 @@ from .helper import (
|
|||
is_win32,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TestFileTiff:
|
||||
def test_sanity(self, tmp_path):
|
||||
|
@ -227,8 +225,8 @@ class TestFileTiff:
|
|||
assert im.getpixel((0, 1)) == 0
|
||||
|
||||
def test_12bit_rawmode(self):
|
||||
""" Are we generating the same interpretation
|
||||
of the image as Imagemagick is? """
|
||||
"""Are we generating the same interpretation
|
||||
of the image as Imagemagick is?"""
|
||||
|
||||
with Image.open("Tests/images/12bit.cropped.tif") as im:
|
||||
# to make the target --
|
||||
|
|
|
@ -2,6 +2,7 @@ import io
|
|||
import struct
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, TiffImagePlugin, TiffTags
|
||||
from PIL.TiffImagePlugin import IFDRational
|
||||
|
||||
|
@ -11,10 +12,10 @@ TAG_IDS = {info.name: info.value for info in TiffTags.TAGS_V2.values()}
|
|||
|
||||
|
||||
def test_rt_metadata(tmp_path):
|
||||
""" Test writing arbitrary metadata into the tiff image directory
|
||||
Use case is ImageJ private tags, one numeric, one arbitrary
|
||||
data. https://github.com/python-pillow/Pillow/issues/291
|
||||
"""
|
||||
"""Test writing arbitrary metadata into the tiff image directory
|
||||
Use case is ImageJ private tags, one numeric, one arbitrary
|
||||
data. https://github.com/python-pillow/Pillow/issues/291
|
||||
"""
|
||||
|
||||
img = hopper()
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import io
|
|||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, WebPImagePlugin, features
|
||||
|
||||
from .helper import (
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import assert_image_equal, assert_image_similar, hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import (
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import assert_image_equal, hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, WmfImagePlugin
|
||||
|
||||
from .helper import assert_image_similar, hopper
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, XpmImagePlugin
|
||||
|
||||
from .helper import assert_image_similar, hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, XVThumbImagePlugin
|
||||
|
||||
from .helper import assert_image_similar, hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import BdfFontFile, FontFile
|
||||
|
||||
filename = "Tests/images/courB08.bdf"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import FontFile, Image, ImageDraw, ImageFont, PcfFontFile
|
||||
|
||||
from .helper import assert_image_equal, assert_image_similar, skip_unless_feature
|
||||
|
|
|
@ -85,7 +85,10 @@ def test_wedge():
|
|||
im.getchannel(0), comparable.getchannel(0), 1, "Hue conversion is wrong"
|
||||
)
|
||||
assert_image_similar(
|
||||
im.getchannel(1), comparable.getchannel(1), 1, "Saturation conversion is wrong",
|
||||
im.getchannel(1),
|
||||
comparable.getchannel(1),
|
||||
1,
|
||||
"Saturation conversion is wrong",
|
||||
)
|
||||
assert_image_similar(
|
||||
im.getchannel(2), comparable.getchannel(2), 1, "Value conversion is wrong"
|
||||
|
@ -113,7 +116,10 @@ def test_convert():
|
|||
im.getchannel(0), comparable.getchannel(0), 1, "Hue conversion is wrong"
|
||||
)
|
||||
assert_image_similar(
|
||||
im.getchannel(1), comparable.getchannel(1), 1, "Saturation conversion is wrong",
|
||||
im.getchannel(1),
|
||||
comparable.getchannel(1),
|
||||
1,
|
||||
"Saturation conversion is wrong",
|
||||
)
|
||||
assert_image_similar(
|
||||
im.getchannel(2), comparable.getchannel(2), 1, "Value conversion is wrong"
|
||||
|
@ -126,11 +132,20 @@ def test_hsv_to_rgb():
|
|||
comparable = to_rgb_colorsys(comparable)
|
||||
|
||||
assert_image_similar(
|
||||
converted.getchannel(0), comparable.getchannel(0), 3, "R conversion is wrong",
|
||||
converted.getchannel(0),
|
||||
comparable.getchannel(0),
|
||||
3,
|
||||
"R conversion is wrong",
|
||||
)
|
||||
assert_image_similar(
|
||||
converted.getchannel(1), comparable.getchannel(1), 3, "G conversion is wrong",
|
||||
converted.getchannel(1),
|
||||
comparable.getchannel(1),
|
||||
3,
|
||||
"G conversion is wrong",
|
||||
)
|
||||
assert_image_similar(
|
||||
converted.getchannel(2), comparable.getchannel(2), 3, "B conversion is wrong",
|
||||
converted.getchannel(2),
|
||||
comparable.getchannel(2),
|
||||
3,
|
||||
"B conversion is wrong",
|
||||
)
|
||||
|
|
|
@ -3,8 +3,9 @@ import os
|
|||
import shutil
|
||||
import tempfile
|
||||
|
||||
import PIL
|
||||
import pytest
|
||||
|
||||
import PIL
|
||||
from PIL import Image, ImageDraw, ImagePalette, ImageShow, UnidentifiedImageError
|
||||
|
||||
from .helper import (
|
||||
|
@ -706,7 +707,8 @@ class TestImage:
|
|||
}
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_module", [PIL, Image],
|
||||
"test_module",
|
||||
[PIL, Image],
|
||||
)
|
||||
def test_pillow_version(self, test_module):
|
||||
with pytest.warns(DeprecationWarning):
|
||||
|
@ -734,7 +736,7 @@ class TestImage:
|
|||
assert test_module.PILLOW_VERSION > "7.0.0"
|
||||
|
||||
def test_overrun(self):
|
||||
""" For overrun completeness, test as:
|
||||
"""For overrun completeness, test as:
|
||||
valgrind pytest -qq Tests/test_image.py::TestImage::test_overrun | grep decode.c
|
||||
"""
|
||||
for file in [
|
||||
|
|
|
@ -2,9 +2,11 @@ import ctypes
|
|||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from distutils import ccompiler, sysconfig
|
||||
import sysconfig
|
||||
|
||||
import pytest
|
||||
from setuptools.command.build_ext import new_compiler
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import assert_image_equal, hopper, is_win32, on_ci
|
||||
|
@ -15,8 +17,9 @@ if os.environ.get("PYTHONOPTIMIZE") == "2":
|
|||
cffi = None
|
||||
else:
|
||||
try:
|
||||
from PIL import PyAccess
|
||||
import cffi
|
||||
|
||||
from PIL import PyAccess
|
||||
except ImportError:
|
||||
cffi = None
|
||||
|
||||
|
@ -358,13 +361,12 @@ int main(int argc, char* argv[])
|
|||
% sys.prefix.replace("\\", "\\\\")
|
||||
)
|
||||
|
||||
compiler = ccompiler.new_compiler()
|
||||
compiler.add_include_dir(sysconfig.get_python_inc())
|
||||
compiler = new_compiler()
|
||||
compiler.add_include_dir(sysconfig.get_config_var("INCLUDEPY"))
|
||||
|
||||
libdir = sysconfig.get_config_var(
|
||||
"LIBDIR"
|
||||
) or sysconfig.get_python_inc().replace("include", "libs")
|
||||
print(libdir)
|
||||
libdir = sysconfig.get_config_var("LIBDIR") or sysconfig.get_config_var(
|
||||
"INCLUDEPY"
|
||||
).replace("include", "libs")
|
||||
compiler.add_library_dir(libdir)
|
||||
objects = compiler.compile(["embed_pil.c"])
|
||||
compiler.link_executable(objects, "embed_pil")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import assert_image, assert_image_equal, assert_image_similar, hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import assert_image_equal, hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, ImageFilter
|
||||
|
||||
from .helper import assert_image_equal, hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, ImageQt
|
||||
|
||||
from .helper import assert_image_equal, hopper
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import logging
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import hopper
|
||||
|
@ -22,6 +24,14 @@ def test_close():
|
|||
im.getpixel((0, 0))
|
||||
|
||||
|
||||
def test_close_after_load(caplog):
|
||||
im = Image.open("Tests/images/hopper.gif")
|
||||
im.load()
|
||||
with caplog.at_level(logging.DEBUG):
|
||||
im.close()
|
||||
assert len(caplog.records) == 0
|
||||
|
||||
|
||||
def test_contextmanager():
|
||||
fn = None
|
||||
with Image.open("Tests/images/hopper.gif") as im:
|
||||
|
|
|
@ -24,9 +24,9 @@ def test_sanity():
|
|||
|
||||
|
||||
def test_16bit_lut():
|
||||
""" Tests for 16 bit -> 8 bit lut for converting I->L images
|
||||
see https://github.com/python-pillow/Pillow/issues/440
|
||||
"""
|
||||
"""Tests for 16 bit -> 8 bit lut for converting I->L images
|
||||
see https://github.com/python-pillow/Pillow/issues/440
|
||||
"""
|
||||
im = hopper("I")
|
||||
im.point(list(range(256)) * 256, "L")
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import ImagePalette
|
||||
|
||||
from .helper import hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import assert_image, assert_image_similar, hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, ImageMath, ImageMode
|
||||
|
||||
from .helper import convert_to_comparable, skip_unless_feature
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from contextlib import contextmanager
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
from .helper import assert_image_equal, assert_image_similar, hopper
|
||||
|
@ -537,7 +538,10 @@ class TestCoreResampleBox:
|
|||
assert res.size == size
|
||||
# Borders should be slightly different
|
||||
assert_image_similar(
|
||||
res, im.crop(box).resize(size, flt), 0.4, f">>> {size} {box} {flt}",
|
||||
res,
|
||||
im.crop(box).resize(size, flt),
|
||||
0.4,
|
||||
f">>> {size} {box} {flt}",
|
||||
)
|
||||
|
||||
def test_skip_vertical(self):
|
||||
|
@ -555,5 +559,8 @@ class TestCoreResampleBox:
|
|||
assert res.size == size
|
||||
# Borders should be slightly different
|
||||
assert_image_similar(
|
||||
res, im.crop(box).resize(size, flt), 0.4, f">>> {size} {box} {flt}",
|
||||
res,
|
||||
im.crop(box).resize(size, flt),
|
||||
0.4,
|
||||
f">>> {size} {box} {flt}",
|
||||
)
|
||||
|
|
|
@ -4,6 +4,7 @@ Tests for resize functionality.
|
|||
from itertools import permutations
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import assert_image_equal, assert_image_similar, hopper
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .helper import (
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import math
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageTransform
|
||||
|
||||
from .helper import assert_image_equal, assert_image_similar, hopper
|
||||
|
|
|
@ -4,6 +4,7 @@ import re
|
|||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageMode, features
|
||||
|
||||
from .helper import assert_image, assert_image_equal, assert_image_similar, hopper
|
||||
|
@ -436,7 +437,7 @@ def test_extended_information():
|
|||
|
||||
|
||||
def test_profile_typesafety():
|
||||
""" Profile init type safety
|
||||
"""Profile init type safety
|
||||
|
||||
prepatch, these would segfault, postpatch they should emit a typeerror
|
||||
"""
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, ImageColor
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import os.path
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageColor, ImageDraw, ImageFont
|
||||
|
||||
from .helper import (
|
||||
|
@ -666,7 +667,10 @@ def test_floodfill_border():
|
|||
|
||||
# Act
|
||||
ImageDraw.floodfill(
|
||||
im, centre_point, ImageColor.getrgb("red"), border=ImageColor.getrgb("black"),
|
||||
im,
|
||||
centre_point,
|
||||
ImageColor.getrgb("red"),
|
||||
border=ImageColor.getrgb("black"),
|
||||
)
|
||||
|
||||
# Assert
|
||||
|
|
|
@ -33,7 +33,9 @@ def _half_transparent_image():
|
|||
def _check_alpha(im, original, op, amount):
|
||||
assert im.getbands() == original.getbands()
|
||||
assert_image_equal(
|
||||
im.getchannel("A"), original.getchannel("A"), f"Diff on {op}: {amount}",
|
||||
im.getchannel("A"),
|
||||
original.getchannel("A"),
|
||||
f"Diff on {op}: {amount}",
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import EpsImagePlugin, Image, ImageFile, features
|
||||
|
||||
from .helper import (
|
||||
|
@ -243,3 +244,8 @@ class TestPyDecoder:
|
|||
im = MockImageFile(buf)
|
||||
assert im.format is None
|
||||
assert im.get_format_mimetype() is None
|
||||
|
||||
def test_oserror(self):
|
||||
im = Image.new("RGB", (1, 1))
|
||||
with pytest.raises(OSError):
|
||||
im.save(BytesIO(), "JPEG2000")
|
||||
|
|
|
@ -7,6 +7,7 @@ from io import BytesIO
|
|||
|
||||
import pytest
|
||||
from packaging.version import parse as parse_version
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont, features
|
||||
|
||||
from .helper import (
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
from .helper import assert_image_similar
|
||||
|
@ -33,6 +34,9 @@ def test_similar():
|
|||
(0, size_final[1] - size_bitmap[1]), text, fill=(0, 0, 0), font=font_bitmap
|
||||
)
|
||||
draw_outline.text(
|
||||
(0, size_final[1] - size_outline[1]), text, fill=(0, 0, 0), font=font_outline,
|
||||
(0, size_final[1] - size_outline[1]),
|
||||
text,
|
||||
fill=(0, 0, 0),
|
||||
font=font_outline,
|
||||
)
|
||||
assert_image_similar(im_bitmap, im_outline, 20)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user