mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +03:00
Merge branch 'master' into reduce
This commit is contained in:
commit
ea9c6e9fe1
|
@ -3,7 +3,7 @@
|
||||||
codecov:
|
codecov:
|
||||||
# Avoid "Missing base report" due to committing CHANGES.rst with "[CI skip]"
|
# Avoid "Missing base report" due to committing CHANGES.rst with "[CI skip]"
|
||||||
# https://github.com/codecov/support/issues/363
|
# https://github.com/codecov/support/issues/363
|
||||||
# https://docs.codecov.io/v4.3.6/docs/comparing-commits
|
# https://docs.codecov.io/docs/comparing-commits
|
||||||
allow_coverage_offsets: true
|
allow_coverage_offsets: true
|
||||||
|
|
||||||
token: 6dafc396-e7f5-4221-a38a-8b07a49fbdae
|
token: 6dafc396-e7f5-4221-a38a-8b07a49fbdae
|
||||||
|
|
3
.github/workflows/lint.yml
vendored
3
.github/workflows/lint.yml
vendored
|
@ -20,6 +20,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Build system information
|
||||||
|
run: python .github/workflows/system-info.py
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
|
|
25
.github/workflows/system-info.py
vendored
Normal file
25
.github/workflows/system-info.py
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
"""
|
||||||
|
Print out some handy system info like Travis CI does.
|
||||||
|
|
||||||
|
This sort of info is missing from GitHub Actions.
|
||||||
|
|
||||||
|
Requested here:
|
||||||
|
https://github.com/actions/virtual-environments/issues/79
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import sys
|
||||||
|
|
||||||
|
print("Build system information")
|
||||||
|
print()
|
||||||
|
|
||||||
|
print("sys.version\t\t", sys.version.split("\n"))
|
||||||
|
print("os.name\t\t\t", os.name)
|
||||||
|
print("sys.platform\t\t", sys.platform)
|
||||||
|
print("platform.system()\t", platform.system())
|
||||||
|
print("platform.machine()\t", platform.machine())
|
||||||
|
print("platform.platform()\t", platform.platform())
|
||||||
|
print("platform.version()\t", platform.version())
|
||||||
|
print("platform.uname()\t", platform.uname())
|
||||||
|
if sys.platform == "darwin":
|
||||||
|
print("platform.mac_ver()\t", platform.mac_ver())
|
3
.github/workflows/test-docker.yml
vendored
3
.github/workflows/test-docker.yml
vendored
|
@ -29,6 +29,9 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Build system information
|
||||||
|
run: python .github/workflows/system-info.py
|
||||||
|
|
||||||
- name: Docker pull
|
- name: Docker pull
|
||||||
run: |
|
run: |
|
||||||
docker pull pythonpillow/${{ matrix.docker }}:${{ matrix.dockerTag }}
|
docker pull pythonpillow/${{ matrix.docker }}:${{ matrix.dockerTag }}
|
||||||
|
|
3
.github/workflows/test-windows.yml
vendored
3
.github/workflows/test-windows.yml
vendored
|
@ -70,6 +70,9 @@ jobs:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
architecture: ${{ matrix.architecture }}
|
architecture: ${{ matrix.architecture }}
|
||||||
|
|
||||||
|
- name: Build system information
|
||||||
|
run: python .github/workflows/system-info.py
|
||||||
|
|
||||||
- name: pip install wheel pytest pytest-cov
|
- name: pip install wheel pytest pytest-cov
|
||||||
run: |
|
run: |
|
||||||
"%pythonLocation%\python.exe" -m pip install wheel pytest pytest-cov
|
"%pythonLocation%\python.exe" -m pip install wheel pytest pytest-cov
|
||||||
|
|
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
|
@ -55,6 +55,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Build system information
|
||||||
|
run: python .github/workflows/system-info.py
|
||||||
|
|
||||||
- name: Install Linux dependencies
|
- name: Install Linux dependencies
|
||||||
if: startsWith(matrix.os, 'ubuntu')
|
if: startsWith(matrix.os, 'ubuntu')
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -5,6 +5,12 @@ Changelog (Pillow)
|
||||||
7.0.0 (unreleased)
|
7.0.0 (unreleased)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
- Add La mode packing and unpacking #4248
|
||||||
|
[homm]
|
||||||
|
|
||||||
|
- Include tests in coverage reports #4173
|
||||||
|
[hugovk]
|
||||||
|
|
||||||
- Handle broken Photoshop data #4239
|
- Handle broken Photoshop data #4239
|
||||||
[radarhere]
|
[radarhere]
|
||||||
|
|
||||||
|
|
|
@ -5,37 +5,43 @@ from .helper import PillowTestCase, hopper
|
||||||
|
|
||||||
class TestImageThumbnail(PillowTestCase):
|
class TestImageThumbnail(PillowTestCase):
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
|
|
||||||
im = hopper()
|
im = hopper()
|
||||||
im.thumbnail((100, 100))
|
self.assertIsNone(im.thumbnail((100, 100)))
|
||||||
|
|
||||||
self.assert_image(im, im.mode, (100, 100))
|
self.assertEqual(im.size, (100, 100))
|
||||||
|
|
||||||
def test_aspect(self):
|
def test_aspect(self):
|
||||||
|
im = Image.new("L", (128, 128))
|
||||||
im = hopper()
|
|
||||||
im.thumbnail((100, 100))
|
im.thumbnail((100, 100))
|
||||||
self.assert_image(im, im.mode, (100, 100))
|
self.assertEqual(im.size, (100, 100))
|
||||||
|
|
||||||
im = hopper().resize((128, 256))
|
im = Image.new("L", (128, 256))
|
||||||
im.thumbnail((100, 100))
|
im.thumbnail((100, 100))
|
||||||
self.assert_image(im, im.mode, (50, 100))
|
self.assertEqual(im.size, (50, 100))
|
||||||
|
|
||||||
im = hopper().resize((128, 256))
|
im = Image.new("L", (128, 256))
|
||||||
im.thumbnail((50, 100))
|
im.thumbnail((50, 100))
|
||||||
self.assert_image(im, im.mode, (50, 100))
|
self.assertEqual(im.size, (50, 100))
|
||||||
|
|
||||||
im = hopper().resize((256, 128))
|
im = Image.new("L", (256, 128))
|
||||||
im.thumbnail((100, 100))
|
im.thumbnail((100, 100))
|
||||||
self.assert_image(im, im.mode, (100, 50))
|
self.assertEqual(im.size, (100, 50))
|
||||||
|
|
||||||
im = hopper().resize((256, 128))
|
im = Image.new("L", (256, 128))
|
||||||
im.thumbnail((100, 50))
|
im.thumbnail((100, 50))
|
||||||
self.assert_image(im, im.mode, (100, 50))
|
self.assertEqual(im.size, (100, 50))
|
||||||
|
|
||||||
im = hopper().resize((128, 128))
|
im = Image.new("L", (128, 128))
|
||||||
im.thumbnail((100, 100))
|
im.thumbnail((100, 100))
|
||||||
self.assert_image(im, im.mode, (100, 100))
|
self.assertEqual(im.size, (100, 100))
|
||||||
|
|
||||||
|
im = Image.new("L", (256, 162)) # ratio is 1.5802469136
|
||||||
|
im.thumbnail((33, 33))
|
||||||
|
self.assertEqual(im.size, (33, 21)) # ratio is 1.5714285714
|
||||||
|
|
||||||
|
im = Image.new("L", (162, 256)) # ratio is 0.6328125
|
||||||
|
im.thumbnail((33, 33))
|
||||||
|
self.assertEqual(im.size, (21, 33)) # ratio is 0.6363636364
|
||||||
|
|
||||||
def test_no_resize(self):
|
def test_no_resize(self):
|
||||||
# Check that draft() can resize the image to the destination size
|
# Check that draft() can resize the image to the destination size
|
||||||
|
@ -46,4 +52,4 @@ class TestImageThumbnail(PillowTestCase):
|
||||||
# Test thumbnail(), where only draft() is necessary to resize the image
|
# Test thumbnail(), where only draft() is necessary to resize the image
|
||||||
with Image.open("Tests/images/hopper.jpg") as im:
|
with Image.open("Tests/images/hopper.jpg") as im:
|
||||||
im.thumbnail((64, 64))
|
im.thumbnail((64, 64))
|
||||||
self.assert_image(im, im.mode, (64, 64))
|
self.assertEqual(im.size, (64, 64))
|
||||||
|
|
|
@ -7,24 +7,3 @@ build & install non-packaged dependencies; useful for testing with Travis CI.
|
||||||
|
|
||||||
``install_extra_test_images.sh`` can be used to install additional test images
|
``install_extra_test_images.sh`` can be used to install additional test images
|
||||||
that are used for Travis CI and AppVeyor.
|
that are used for Travis CI and AppVeyor.
|
||||||
|
|
||||||
The other scripts can be used to install all of the dependencies for
|
|
||||||
the listed operating systems/distros. The ``ubuntu_14.04.sh`` and
|
|
||||||
``debian_8.2.sh`` scripts have been tested on bare AWS images and will
|
|
||||||
install all required dependencies for the system Python 2.7 and 3.4
|
|
||||||
for all of the optional dependencies. Git may also be required prior
|
|
||||||
to running the script to actually download Pillow.
|
|
||||||
|
|
||||||
e.g.::
|
|
||||||
|
|
||||||
$ sudo apt-get install git
|
|
||||||
$ git clone https://github.com/python-pillow/Pillow.git
|
|
||||||
$ cd Pillow/depends
|
|
||||||
$ ./debian_8.2.sh
|
|
||||||
$ cd ..
|
|
||||||
$ git checkout [branch or tag]
|
|
||||||
$ virtualenv -p /usr/bin/python2.7 ~/vpy27
|
|
||||||
$ source ~/vpy27/bin/activate
|
|
||||||
$ make install
|
|
||||||
$ make test
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
pkg -y install python python-dev ndk-sysroot clang make \
|
pkg install -y python ndk-sysroot clang make \
|
||||||
libjpeg-turbo-dev
|
libjpeg-turbo
|
||||||
|
|
||||||
|
|
|
@ -15,24 +15,25 @@ Notes
|
||||||
|
|
||||||
.. note:: Pillow is supported on the following Python versions
|
.. note:: Pillow is supported on the following Python versions
|
||||||
|
|
||||||
|
|
||||||
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||||
|**Python** |**2.4**|**2.5**|**2.6**|**2.7**|**3.2**|**3.3**|**3.4**|**3.5**|**3.6**|**3.7**|**3.8**|
|
|**Python** |**3.8**|**3.7**|**3.6**|**3.5**|**3.4**|**3.3**|**3.2**|**2.7**|**2.6**|**2.5**|**2.4**|
|
||||||
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||||
|Pillow < 2 | Yes | Yes | Yes | Yes | | | | | | | |
|
|Pillow >= 7 | Yes | Yes | Yes | Yes | | | | | | | |
|
||||||
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||||
|Pillow 2 - 3 | | | Yes | Yes | Yes | Yes | Yes | Yes | | | |
|
|Pillow 6.2.1 | Yes | Yes | Yes | Yes | | | | Yes | | | |
|
||||||
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||||
|Pillow 4 | | | | Yes | | Yes | Yes | Yes | Yes | | |
|
|Pillow 6.0 - 6.2.0 | | Yes | Yes | Yes | | | | Yes | | | |
|
||||||
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||||
|Pillow 5.0 - 5.1 | | | | Yes | | | Yes | Yes | Yes | | |
|
|Pillow 5.2 - 5.4 | | Yes | Yes | Yes | Yes | | | Yes | | | |
|
||||||
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||||
|Pillow 5.2 - 5.4 | | | | Yes | | | Yes | Yes | Yes | Yes | |
|
|Pillow 5.0 - 5.1 | | | Yes | Yes | Yes | | | Yes | | | |
|
||||||
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||||
|Pillow 6.0 - 6.2.0 | | | | Yes | | | | Yes | Yes | Yes | |
|
|Pillow 4 | | | Yes | Yes | Yes | Yes | | Yes | | | |
|
||||||
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||||
|Pillow 6.2.1 | | | | Yes | | | | Yes | Yes | Yes | Yes |
|
|Pillow 2 - 3 | | | | Yes | Yes | Yes | Yes | Yes | Yes | | |
|
||||||
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||||
|Pillow >= 7 | | | | | | | | Yes | Yes | Yes | Yes |
|
|Pillow < 2 | | | | | | | | Yes | Yes | Yes | Yes |
|
||||||
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
+-------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||||
|
|
||||||
Basic Installation
|
Basic Installation
|
||||||
|
@ -95,14 +96,13 @@ Pillow can be installed on FreeBSD via the official Ports or Packages systems:
|
||||||
|
|
||||||
**Packages**::
|
**Packages**::
|
||||||
|
|
||||||
$ pkg install py27-pillow
|
$ pkg install py36-pillow
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
The `Pillow FreeBSD port
|
The `Pillow FreeBSD port
|
||||||
<https://www.freshports.org/graphics/py-pillow/>`_ and packages
|
<https://www.freshports.org/graphics/py-pillow/>`_ and packages
|
||||||
are tested by the ports team with all supported FreeBSD versions
|
are tested by the ports team with all supported FreeBSD versions.
|
||||||
and against Python 2.7 and 3.x.
|
|
||||||
|
|
||||||
|
|
||||||
Building From Source
|
Building From Source
|
||||||
|
@ -174,8 +174,6 @@ Many of Pillow's features require external libraries:
|
||||||
* Libimagequant is licensed GPLv3, which is more restrictive than
|
* Libimagequant is licensed GPLv3, which is more restrictive than
|
||||||
the Pillow license, therefore we will not be distributing binaries
|
the Pillow license, therefore we will not be distributing binaries
|
||||||
with libimagequant support enabled.
|
with libimagequant support enabled.
|
||||||
* Windows support: Libimagequant requires VS2015/MSVC 19 to compile,
|
|
||||||
so it is unlikely to work with Python 2.7 on Windows.
|
|
||||||
|
|
||||||
* **libraqm** provides complex text layout support.
|
* **libraqm** provides complex text layout support.
|
||||||
|
|
||||||
|
@ -189,7 +187,7 @@ Many of Pillow's features require external libraries:
|
||||||
libraqm.
|
libraqm.
|
||||||
* libraqm is dynamically loaded in Pillow 5.0.0 and above, so support
|
* libraqm is dynamically loaded in Pillow 5.0.0 and above, so support
|
||||||
is available if all the libraries are installed.
|
is available if all the libraries are installed.
|
||||||
* Windows support: Raqm support is currently unsupported on Windows.
|
* Windows support: Raqm is not included in prebuilt wheels
|
||||||
|
|
||||||
Once you have installed the prerequisites, run::
|
Once you have installed the prerequisites, run::
|
||||||
|
|
||||||
|
@ -361,8 +359,8 @@ Building on Android
|
||||||
Basic Android support has been added for compilation within the Termux
|
Basic Android support has been added for compilation within the Termux
|
||||||
environment. The dependencies can be installed by::
|
environment. The dependencies can be installed by::
|
||||||
|
|
||||||
$ pkg -y install python python-dev ndk-sysroot clang make \
|
$ pkg install -y python ndk-sysroot clang make \
|
||||||
libjpeg-turbo-dev
|
libjpeg-turbo
|
||||||
|
|
||||||
This has been tested within the Termux app on ChromeOS, on x86.
|
This has been tested within the Termux app on ChromeOS, on x86.
|
||||||
|
|
||||||
|
@ -381,40 +379,44 @@ Continuous Integration Targets
|
||||||
|
|
||||||
These platforms are built and tested for every change.
|
These platforms are built and tested for every change.
|
||||||
|
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
|**Operating system** |**Tested Python versions** |**Tested Architecture**|
|
|**Operating system** |**Tested Python versions**|**Tested architecture**|
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
| Alpine | 2.7, 3.7 |x86-64 |
|
| Alpine | 3.7 |x86-64 |
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
| Arch | 2.7, 3.7 |x86-64 |
|
| Arch | 3.7 |x86-64 |
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
| Amazon Linux 1 | 2.7, 3.6 |x86-64 |
|
| Amazon Linux 1 | 3.6 |x86-64 |
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
| Amazon Linux 2 | 2.7, 3.6 |x86-64 |
|
| Amazon Linux 2 | 3.6 |x86-64 |
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
| CentOS 6 | 2.7, 3.6 |x86-64 |
|
| CentOS 6 | 3.6 |x86-64 |
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
| CentOS 7 | 2.7, 3.6 |x86-64 |
|
| CentOS 7 | 3.6 |x86-64 |
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
| Debian 9 Stretch | 2.7, 3.5 |x86 |
|
| Debian 9 Stretch | 3.5 |x86 |
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
| Debian 10 Buster | 2.7, 3.7 |x86 |
|
| Debian 10 Buster | 3.7 |x86 |
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
| Fedora 30 | 2.7, 3.7 |x86-64 |
|
| Fedora 30 | 3.7 |x86-64 |
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
| Fedora 31 | 3.7 |x86-64 |
|
| Fedora 31 | 3.7 |x86-64 |
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
| macOS 10.13 High Sierra* | 2.7, 3.5, 3.6, 3.7, 3.8 |x86-64 |
|
| macOS 10.13 High Sierra | 3.5, 3.6, 3.7, 3.8 |x86-64 |
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
| Ubuntu Linux 16.04 LTS | 2.7, 3.5, 3.6, 3.7, 3.8, |x86-64 |
|
| macOS 10.15 Catalina | PyPy3 |x86-64 |
|
||||||
| | PyPy, PyPy3 | |
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
| Ubuntu Linux 16.04 LTS | 3.5, 3.6, 3.7, 3.8, PyPy3|x86-64 |
|
||||||
| Windows Server 2012 R2 | 2.7, 3.5, 3.6, 3.7, 3.8 |x86, x86-64 |
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
| +-------------------------------+-----------------------+
|
| Windows Server 2012 R2 | 3.5, 3.8 |x86, x86-64 |
|
||||||
| | PyPy, 3.7/MinGW |x86 |
|
| +--------------------------+-----------------------+
|
||||||
+----------------------------------+-------------------------------+-----------------------+
|
| | PyPy3, 3.7/MinGW |x86 |
|
||||||
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
|
| Windows Server 2019 | 3.5, 3.6, 3.7, 3.8 |x86, x86-64 |
|
||||||
|
| +--------------------------+-----------------------+
|
||||||
|
| | PyPy3 |x86 |
|
||||||
|
+----------------------------------+--------------------------+-----------------------+
|
||||||
|
|
||||||
\* macOS CI is not run for every commit, but is run for every release.
|
|
||||||
|
|
||||||
Other Platforms
|
Other Platforms
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
|
@ -2170,11 +2170,11 @@ class Image:
|
||||||
# preserve aspect ratio
|
# preserve aspect ratio
|
||||||
x, y = self.size
|
x, y = self.size
|
||||||
if x > size[0]:
|
if x > size[0]:
|
||||||
y = int(max(y * size[0] / x, 1))
|
y = max(round(y * size[0] / x), 1)
|
||||||
x = int(size[0])
|
x = size[0]
|
||||||
if y > size[1]:
|
if y > size[1]:
|
||||||
x = int(max(x * size[1] / y, 1))
|
x = max(round(x * size[1] / y), 1)
|
||||||
y = int(size[1])
|
y = size[1]
|
||||||
size = x, y
|
size = x, y
|
||||||
|
|
||||||
if size == self.size:
|
if size == self.size:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user