Skip to content

Commit

Permalink
Merge branch 'master' into update_py_unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jun 22, 2019
2 parents a4fd4c2 + 9d5a50a commit f1a4a23
Show file tree
Hide file tree
Showing 210 changed files with 4,928 additions and 3,146 deletions.
4 changes: 1 addition & 3 deletions .github/CONTRIBUTING.md
Expand Up @@ -34,6 +34,4 @@ The best reproductions are self-contained scripts with minimal dependencies. If

## Security vulnerabilities

To report sensitive vulnerability information, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.

If your organisation/employer is a distributor of Pillow and would like advance notification of security-related bugs, please let us know your preferred contact method.
Please see our [security policy](https://github.com/python-pillow/Pillow/blob/master/.github/SECURITY.md).
1 change: 1 addition & 0 deletions .github/FUNDING.yml
@@ -0,0 +1 @@
tidelift: pypi/pillow
19 changes: 0 additions & 19 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

59 changes: 59 additions & 0 deletions .github/ISSUE_TEMPLATE/ISSUE_REPORT.md
@@ -0,0 +1,59 @@
---
name: Issue report
about: Create a report to help us improve Pillow
---

<!--
Thank you for reporting an issue.
Follow these guidelines to ensure your issue is handled properly.
If you have a ...
1. General question: consider asking the question on Stack Overflow
with the python-imaging-library tag:
* https://stackoverflow.com/questions/tagged/python-imaging-library
Do not ask a question in both places.
If you think you have found a bug or have an unexplained exception
then file a bug report here.
2. Bug report: include a self-contained, copy-pastable example that
generates the issue if possible. Be concise with code posted.
Guidelines on how to provide a good bug report:
* https://stackoverflow.com/help/mcve
Bug reports which follow these guidelines are easier to diagnose,
and are often handled much more quickly.
3. Feature request: do a quick search of existing issues
to make sure this has not been asked before.
We know asking good questions takes effort, and we appreciate your time.
Thank you.
-->

### What did you do?

### What did you expect to happen?

### What actually happened?

### What are your OS, Python and Pillow versions?

* OS:
* Python:
* Pillow:

<!--
Please include **code** that reproduces the issue and whenever possible, an **image** that demonstrates the issue. Please upload images to GitHub, not to third-party file hosting sites. If necessary, add the image to a zip or tar archive.
The best reproductions are self-contained scripts with minimal dependencies. If you are using a framework such as Plone, Django, or Buildout, try to replicate the issue just using Pillow.
-->

```python
code goes here
```
5 changes: 5 additions & 0 deletions .github/SECURITY.md
@@ -0,0 +1,5 @@
# Security policy

To report sensitive vulnerability information, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.

If your organisation/employer is a distributor of Pillow and would like advance notification of security-related bugs, please let us know your preferred contact method.
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -16,9 +16,9 @@ matrix:
- python: "3.6"
name: "Lint"
env: LINT="true"
- python: "pypy2.7-6.0"
- python: "pypy"
name: "PyPy2 Xenial"
- python: "pypy3.5-6.0"
- python: "pypy3"
name: "PyPy3 Xenial"
- python: '3.7'
name: "3.7 Xenial"
Expand All @@ -44,8 +44,8 @@ matrix:
- env: DOCKER="centos-7-amd64" DOCKER_TAG="master"
- env: DOCKER="amazon-1-amd64" DOCKER_TAG="master"
- env: DOCKER="amazon-2-amd64" DOCKER_TAG="master"
- env: DOCKER="fedora-28-amd64" DOCKER_TAG="master"
- env: DOCKER="fedora-29-amd64" DOCKER_TAG="master"
- env: DOCKER="fedora-30-amd64" DOCKER_TAG="master"

services:
- docker
Expand Down
83 changes: 82 additions & 1 deletion CHANGES.rst
Expand Up @@ -2,6 +2,87 @@
Changelog (Pillow)
==================

6.1.0 (unreleased)
------------------

- Fixed bugs in calculating text size #3864
[radarhere]

- Add __main__.py to output basic format and support information #3870
[jdufresne]

- Added variation font support #3802
[radarhere]

- Do not down-convert if image is LA when showing with PNG format #3869
[radarhere]

- Improve handling of PSD frames #3759
[radarhere]

- Improved ICO and ICNS loading #3897
[radarhere]

- Changed Preview application path so that it is no longer static #3896
[radarhere]

- Corrected ttb text positioning #3856
[radarhere]

- Handle unexpected ICO image sizes #3836
[radarhere]

- Fixed bits value for RGB;16N unpackers #3837
[kkopachev]

- Travis CI: Add Fedora 30, remove Fedora 28 #3821
[hugovk]

- Added reading of CMYK;16L TIFF images #3817
[radarhere]

- Fixed dimensions of 1-bit PDFs #3827
[radarhere]

- Fixed opening mmap image through Path on Windows #3825
[radarhere]

- Fixed ImageDraw arc gaps #3824
[radarhere]

- Expand GIF to include frames with extents outside the image size #3822
[radarhere]

- Fixed ImageTk getimage #3814
[radarhere]

- Fixed bug in decoding large images #3791
[radarhere]

- Fixed reading APP13 marker without Photoshop data #3771
[radarhere]

- Added option to include layered windows in ImageGrab.grab on Windows #3808
[radarhere]

- Detect libimagequant when installed by pacman on MingW #3812
[radarhere]

- Fixed raqm layout bug #3787
[radarhere]

- Fixed loading font with non-Unicode path on Windows #3785
[radarhere]

- Travis CI: Upgrade PyPy from 6.0.0 to 7.1.1 #3783
[hugovk, johnthagen]

- Depends: Updated openjpeg to 2.3.1 #3794, raqm to 0.7.0 #3877, libimagequant to 2.12.3 #3889
[radarhere]

- Fix numpy bool bug #3790
[radarhere]

6.0.0 (2019-04-01)
------------------

Expand Down Expand Up @@ -1408,7 +1489,7 @@ Changelog (Pillow)
- Test: Faster assert_image_similar #2279
[homm]

- Removed depreciated internal "stretch" method #2276
- Removed deprecated internal "stretch" method #2276
[homm]

- Removed the handles_eof flag in decode.c #2223
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -4,7 +4,7 @@ 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.
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>`_.

.. start-badges
Expand Down
11 changes: 11 additions & 0 deletions Tests/check_large_memory.py
Expand Up @@ -12,6 +12,12 @@
# 2.7 and 3.2.

from PIL import Image

try:
import numpy
except ImportError:
numpy = None

YDIM = 32769
XDIM = 48000

Expand All @@ -32,6 +38,11 @@ def test_2gpx(self):
"""failed prepatch"""
self._write_png(XDIM, XDIM)

@unittest.skipIf(numpy is None, "Numpy is not installed")
def test_size_greater_than_int(self):
arr = numpy.ndarray(shape=(16394, 16394))
Image.fromarray(arr)


if __name__ == '__main__':
unittest.main()
Binary file added Tests/fonts/AdobeVFPrototype.ttf
Binary file not shown.
Binary file added Tests/fonts/ArefRuqaa-Regular.ttf
Binary file not shown.
Binary file added Tests/fonts/KhmerOSBattambang-Regular.ttf
Binary file not shown.
14 changes: 7 additions & 7 deletions Tests/fonts/LICENSE.txt
@@ -1,13 +1,13 @@

NotoNastaliqUrdu-Regular.ttf, NotoSansSymbols-Regular.ttf:
NotoNastaliqUrdu-Regular.ttf and NotoSansSymbols-Regular.ttf, from https://github.com/googlei18n/noto-fonts
NotoSansJP-Thin.otf, from https://www.google.com/get/noto/help/cjk/
AdobeVFPrototype.ttf, from https://github.com/adobe-fonts/adobe-variable-font-prototype
TINY5x3GX.ttf, from http://velvetyne.fr/fonts/tiny
ArefRuqaa-Regular.ttf, from https://github.com/google/fonts/tree/master/ofl/arefruqaa

(from https://github.com/googlei18n/noto-fonts)
All of the above fonts are published under the SIL Open Font License (OFL) v1.1 (http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL), which allows you to copy, modify, and redistribute them if you need to.

All Noto fonts are published under the SIL Open Font License (OFL) v1.1 (http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL), which allows you to copy, modify, and redistribute them if you need to.


10x20-ISO8859-1.pcf

(from https://packages.ubuntu.com/xenial/xfonts-base)
10x20-ISO8859-1.pcf, from https://packages.ubuntu.com/xenial/xfonts-base

"Public domain font. Share and enjoy."
Binary file added Tests/fonts/NotoSansJP-Regular.otf
Binary file not shown.
Binary file added Tests/fonts/TINY5x3GX.ttf
Binary file not shown.
Binary file added Tests/images/app13.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/hopper_draw.ico
Binary file not shown.
Binary file added Tests/images/hopper_unexpected.ico
Binary file not shown.
Binary file added Tests/images/imagedraw_arc_width_pieslice.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/imagedraw_ellipse_width_large.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/test_complex_unicode_text2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/test_direction_ttb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/test_extents.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/test_x_max_and_y_offset.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Tests/images/test_y_offset.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/tiff_16bit_RGB.tiff
Binary file not shown.
Binary file added Tests/images/tiff_16bit_RGB_target.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/tiff_strip_cmyk_16l_jpeg.tif
Binary file not shown.
Binary file added Tests/images/variation_adobe.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/variation_adobe_axes.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/variation_adobe_name.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/variation_tiny.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/variation_tiny_axes.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Tests/images/variation_tiny_name.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Tests/test_box_blur.py
Expand Up @@ -175,7 +175,7 @@ def test_radius_bigger_then_width(self):
delta=0,
)

def test_exteme_large_radius(self):
def test_extreme_large_radius(self):
self.assertBlur(
sample, 600,
[
Expand Down
26 changes: 26 additions & 0 deletions Tests/test_features.py
@@ -1,3 +1,7 @@
from __future__ import unicode_literals

import io

from .helper import unittest, PillowTestCase

from PIL import features
Expand Down Expand Up @@ -63,3 +67,25 @@ def test_unsupported_module(self):
module = "unsupported_module"
# Act / Assert
self.assertRaises(ValueError, features.check_module, module)

def test_pilinfo(self):
buf = io.StringIO()
features.pilinfo(buf)
out = buf.getvalue()
lines = out.splitlines()
self.assertEqual(lines[0], "-" * 68)
self.assertTrue(lines[1].startswith("Pillow "))
self.assertEqual(lines[2], "-" * 68)
self.assertTrue(lines[3].startswith("Python modules loaded from "))
self.assertTrue(lines[4].startswith("Binary modules loaded from "))
self.assertEqual(lines[5], "-" * 68)
self.assertTrue(lines[6].startswith("Python "))
jpeg = (
"\n" +
"-" * 68 + "\n" +
"JPEG image/jpeg\n" +
"Extensions: .jfif, .jpe, .jpeg, .jpg\n" +
"Features: open, save\n" +
"-" * 68 + "\n"
)
self.assertIn(jpeg, out)
6 changes: 6 additions & 0 deletions Tests/test_file_gif.py
Expand Up @@ -663,3 +663,9 @@ def test_lzw_bits(self):
self.assertEqual(im.tile[0][3][0], 11) # LZW bits
# codec error prepatch
im.load()

def test_extents(self):
im = Image.open('Tests/images/test_extents.gif')
self.assertEqual(im.size, (100, 100))
im.seek(1)
self.assertEqual(im.size, (150, 150))
9 changes: 4 additions & 5 deletions Tests/test_file_icns.py
Expand Up @@ -61,11 +61,10 @@ def test_sizes(self):
for w, h, r in im.info['sizes']:
wr = w * r
hr = h * r
im2 = Image.open(TEST_FILE)
im2.size = (w, h, r)
im2.load()
self.assertEqual(im2.mode, 'RGBA')
self.assertEqual(im2.size, (wr, hr))
im.size = (w, h, r)
im.load()
self.assertEqual(im.mode, 'RGBA')
self.assertEqual(im.size, (wr, hr))

# Check that we cannot load an incorrect size
with self.assertRaises(ValueError):
Expand Down
22 changes: 21 additions & 1 deletion Tests/test_file_ico.py
@@ -1,7 +1,7 @@
from .helper import PillowTestCase, hopper

import io
from PIL import Image, IcoImagePlugin
from PIL import Image, ImageDraw, IcoImagePlugin

TEST_ICO_FILE = "Tests/images/hopper.ico"

Expand Down Expand Up @@ -83,3 +83,23 @@ def test_only_save_relevant_sizes(self):
self.assertEqual(
im_saved.info['sizes'],
{(16, 16), (24, 24), (32, 32), (48, 48)})

def test_unexpected_size(self):
# This image has been manually hexedited to state that it is 16x32
# while the image within is still 16x16
im = self.assert_warning(UserWarning,
Image.open, "Tests/images/hopper_unexpected.ico")
self.assertEqual(im.size, (16, 16))

def test_draw_reloaded(self):
im = Image.open(TEST_ICO_FILE)
outfile = self.tempfile("temp_saved_hopper_draw.ico")

draw = ImageDraw.Draw(im)
draw.line((0, 0) + im.size, '#f00')
im.save(outfile)

im = Image.open(outfile)
im.save("Tests/images/hopper_draw.ico")
reloaded = Image.open("Tests/images/hopper_draw.ico")
self.assert_image_equal(im, reloaded)
2 changes: 1 addition & 1 deletion Tests/test_file_im.py
Expand Up @@ -48,7 +48,7 @@ def test_eoferror(self):
im.seek(n_frames-1)

def test_roundtrip(self):
for mode in ["RGB", "P"]:
for mode in ["RGB", "P", "PA"]:
out = self.tempfile('temp.im')
im = hopper(mode)
im.save(out)
Expand Down
4 changes: 4 additions & 0 deletions Tests/test_file_jpeg.py
Expand Up @@ -620,6 +620,10 @@ def test_photoshop(self):
'DisplayedUnitsY': 1,
})

# This image does not contain a Photoshop header string
im = Image.open("Tests/images/app13.jpg")
self.assertNotIn("photoshop", im.info)


@unittest.skipUnless(sys.platform.startswith('win32'), "Windows only")
class TestFileCloseW32(PillowTestCase):
Expand Down

0 comments on commit f1a4a23

Please sign in to comment.