Skip to content

Commit

Permalink
Merge pull request #1 from python-pillow/master
Browse files Browse the repository at this point in the history
Update local base
  • Loading branch information
abojja9 authored Apr 6, 2019
2 parents 30841fe + b636dde commit 2f13422
Show file tree
Hide file tree
Showing 86 changed files with 1,346 additions and 522 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ install:
}
else
{
c:\python34\python.exe c:\pillow\winbuild\build_dep.py
c:\python37\python.exe c:\pillow\winbuild\build_dep.py
c:\pillow\winbuild\build_deps.cmd
$host.SetShouldExit(0)
}
Expand Down
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Please send a pull request to the master branch. Please include [documentation](
- Fork the Pillow repository.
- Create a branch from master.
- Develop bug fixes, features, tests, etc.
- Run the test suite on Python 2.7 and 3.x. You can enable [Travis CI](https://travis-ci.org/profile/) and [AppVeyor](https://ci.appveyor.com/projects/new) on your repo to catch test failures prior to the pull request, and [Coveralls](https://coveralls.io/repos/new) to see if the changed code is covered by tests.
- Run the test suite on Python 2.7 and 3.x. You can enable [Travis CI](https://travis-ci.org/profile/) and [AppVeyor](https://ci.appveyor.com/projects/new) on your repo to catch test failures prior to the pull request, and [Codecov](https://codecov.io/gh) to see if the changed code is covered by tests.
- Create a pull request to pull the changes from your branch to the Pillow master.

### Guidelines
Expand Down
27 changes: 2 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,25 @@ matrix:
env: LINT="true"
- python: "pypy2.7-6.0"
name: "PyPy2 Xenial"
dist: xenial
- python: "pypy3.5-6.0"
name: "PyPy3 Xenial"
dist: xenial
- python: '3.7'
name: "3.7 Xenial"
- python: '2.7'
name: "2.7 Xenial"
- python: '2.7'
name: "2.7 Trusty"
dist: trusty
- python: "2.7_with_system_site_packages" # For PyQt4
name: "2.7_with_system_site_packages Xenial"
services: xvfb
- python: "2.7_with_system_site_packages" # For PyQt4
name: "2.7_with_system_site_packages Trusty"
dist: trusty
- python: '3.6'
name: "3.6 Xenial"
- python: '3.6'
name: "3.6 Trusty PYTHONOPTIMIZE=1"
dist: trusty
name: "3.6 Xenial PYTHONOPTIMIZE=1"
env: PYTHONOPTIMIZE=1
- python: '3.5'
name: "3.5 Xenial"
- python: '3.5'
name: "3.5 Trusty PYTHONOPTIMIZE=2"
dist: trusty
name: "3.5 Xenial PYTHONOPTIMIZE=2"
env: PYTHONOPTIMIZE=2
- python: "3.8-dev"
name: "3.8-dev Xenial"
- env: DOCKER="alpine" DOCKER_TAG="master"
- env: DOCKER="arch" DOCKER_TAG="master" # contains PyQt5
- env: DOCKER="ubuntu-trusty-x86" DOCKER_TAG="master"
- env: DOCKER="ubuntu-xenial-amd64" DOCKER_TAG="master"
- env: DOCKER="debian-stretch-x86" DOCKER_TAG="master"
- env: DOCKER="centos-6-amd64" DOCKER_TAG="master"
Expand All @@ -75,14 +60,6 @@ install:
.travis/install.sh;
fi
before_script:
# Qt needs a display for some of the tests, and it's only run on the system site packages install
- |
if [ "$TRAVIS_JOB_NAME" == "2.7_with_system_site_packages Trusty" ]; then
export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start
fi
script:
- |
if [ "$LINT" == "true" ]; then
Expand Down
62 changes: 61 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,72 @@
Changelog (Pillow)
==================

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

- Python 2.7 support will be removed in Pillow 7.0.0 #3682
[hugovk]

- Add EXIF class #3625
[radarhere]

- Add ImageOps exif_transpose method #3687
[radarhere]

- Added warnings to deprecated CMSProfile attributes #3615
[hugovk]

- Documented reading TIFF multiframe images #3720
[akuchling]

- Improved speed of opening an MPO file #3658
[Glandos]

- Update palette in quantize #3721
[radarhere]

- Improvements to TIFF is_animated and n_frames #3714
[radarhere]

- Fixed incompatible pointer type warnings #3754
[radarhere]

- Improvements to PA and LA conversion and palette operations #3728
[radarhere]

- Consistent DPI rounding #3709
[radarhere]

- Change size of MPO image to match frame #3588
[radarhere]

- Read Photoshop resolution data #3701
[radarhere]

- Ensure image is mutable before saving #3724
[radarhere]

- Correct remap_palette documentation #3740
[radarhere]

- Promote P images to PA in putalpha #3726
[radarhere]

- Allow RGB and RGBA values for new P images #3719
[radarhere]

- Fixed TIFF bug when seeking backwards and then forwards #3713
[radarhere]

- Cache EXIF information #3498
[Glandos]

- Added transparency for all PNG greyscale modes #3744
[radarhere]

- Fix deprecation warnings in Python 3.8 #3749
[radarhere]

- Fixed GIF bug when rewinding to a non-zero frame #3716
[radarhere]

Expand Down
49 changes: 26 additions & 23 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,30 @@ Pillow is the friendly PIL fork by `Alex Clark and Contributors <https://github.
* - 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
Expand All @@ -36,8 +60,8 @@ Pillow is the friendly PIL fork by `Alex Clark and Contributors <https://github.
:target: https://ci.appveyor.com/project/python-pillow/Pillow
:alt: AppVeyor CI build status (Windows)

.. |coverage| image:: https://coveralls.io/repos/python-pillow/Pillow/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/python-pillow/Pillow?branch=master
.. |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
Expand All @@ -61,24 +85,3 @@ Pillow is the friendly PIL fork by `Alex Clark and Contributors <https://github.
.. |twitter| image:: https://img.shields.io/badge/tweet-on%20Twitter-00aced.svg
:target: https://twitter.com/PythonPillow
:alt: Follow on https://twitter.com/PythonPillow

.. 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>`_
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ Released as needed privately to individual vendors for critical security-related

## Documentation

* [ ] Make sure the default version for Read the Docs is the latest tagged release e.g. `d2d43879` (5.4.0)
* [ ] Make sure the [default version for Read the Docs](https://pillow.readthedocs.io/en/stable/) is up-to-date with the release changes
Binary file added Tests/images/1_trns.png
Loading
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/drawing_roundDown.emf
Binary file not shown.
Binary file added Tests/images/fujifilm.mpo
Binary file not shown.
Binary file added Tests/images/hopper_orientation_2.jpg
Loading
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_orientation_2.webp
Binary file not shown.
Binary file added Tests/images/hopper_orientation_3.jpg
Loading
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_orientation_3.webp
Binary file not shown.
Binary file added Tests/images/hopper_orientation_4.jpg
Loading
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_orientation_4.webp
Binary file not shown.
Binary file added Tests/images/hopper_orientation_5.jpg
Loading
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_orientation_5.webp
Binary file not shown.
Binary file added Tests/images/hopper_orientation_6.jpg
Loading
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_orientation_6.webp
Binary file not shown.
Binary file added Tests/images/hopper_orientation_7.jpg
Loading
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_orientation_7.webp
Binary file not shown.
Binary file added Tests/images/hopper_orientation_8.jpg
Loading
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_orientation_8.webp
Binary file not shown.
Binary file added Tests/images/hopper_roundDown.bmp
Binary file not shown.
Binary file added Tests/images/hopper_roundDown_2.tif
Binary file not shown.
Binary file added Tests/images/hopper_roundDown_3.tif
Binary file not shown.
Binary file added Tests/images/hopper_roundDown_None.tif
Binary file not shown.
Binary file added Tests/images/hopper_roundUp_2.tif
Binary file not shown.
Binary file added Tests/images/hopper_roundUp_3.tif
Binary file not shown.
Binary file added Tests/images/hopper_roundUp_None.tif
Binary file not shown.
Binary file added Tests/images/i_trns.png
Loading
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/iptc_roundDown.jpg
Loading
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/iptc_roundUp.jpg
Loading
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/sugarshack_frame_size.mpo
Binary file not shown.
21 changes: 21 additions & 0 deletions Tests/test_file_bmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,27 @@ def test_save_bmp_with_dpi(self):
self.assertEqual(im.size, reloaded.size)
self.assertEqual(reloaded.format, "JPEG")

def test_load_dpi_rounding(self):
# Round up
im = Image.open('Tests/images/hopper.bmp')
self.assertEqual(im.info["dpi"], (96, 96))

# Round down
im = Image.open('Tests/images/hopper_roundDown.bmp')
self.assertEqual(im.info["dpi"], (72, 72))

def test_save_dpi_rounding(self):
outfile = self.tempfile("temp.bmp")
im = Image.open('Tests/images/hopper.bmp')

im.save(outfile, dpi=(72.2, 72.2))
reloaded = Image.open(outfile)
self.assertEqual(reloaded.info["dpi"], (72, 72))

im.save(outfile, dpi=(72.8, 72.8))
reloaded = Image.open(outfile)
self.assertEqual(reloaded.info["dpi"], (73, 73))

def test_load_dib(self):
# test for #1293, Imagegrab returning Unsupported Bitfields Format
im = Image.open('Tests/images/clipboard.dib')
Expand Down
30 changes: 30 additions & 0 deletions Tests/test_file_jpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,27 @@ def test_save_tiff_with_dpi(self):
reloaded.load()
self.assertEqual(im.info['dpi'], reloaded.info['dpi'])

def test_load_dpi_rounding(self):
# Round up
im = Image.open('Tests/images/iptc_roundUp.jpg')
self.assertEqual(im.info["dpi"], (44, 44))

# Round down
im = Image.open('Tests/images/iptc_roundDown.jpg')
self.assertEqual(im.info["dpi"], (2, 2))

def test_save_dpi_rounding(self):
outfile = self.tempfile("temp.jpg")
im = Image.open('Tests/images/hopper.jpg')

im.save(outfile, dpi=(72.2, 72.2))
reloaded = Image.open(outfile)
self.assertEqual(reloaded.info["dpi"], (72, 72))

im.save(outfile, dpi=(72.8, 72.8))
reloaded = Image.open(outfile)
self.assertEqual(reloaded.info["dpi"], (73, 73))

def test_dpi_tuple_from_exif(self):
# Arrange
# This Photoshop CC 2017 image has DPI in EXIF not metadata
Expand Down Expand Up @@ -590,6 +611,15 @@ def test_ifd_offset_exif(self):
# Act / Assert
self.assertEqual(im._getexif()[306], '2017:03:13 23:03:09')

def test_photoshop(self):
im = Image.open("Tests/images/photoshop-200dpi.jpg")
self.assertEqual(im.info["photoshop"][0x03ed], {
'XResolution': 200.0,
'DisplayedUnitsX': 1,
'YResolution': 200.0,
'DisplayedUnitsY': 1,
})


@unittest.skipUnless(sys.platform.startswith('win32'), "Windows only")
class TestFileCloseW32(PillowTestCase):
Expand Down
21 changes: 21 additions & 0 deletions Tests/test_file_mpo.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,27 @@ def test_exif(self):
self.assertEqual(info[296], 2)
self.assertEqual(info[34665], 188)

def test_frame_size(self):
# This image has been hexedited to contain a different size
# in the EXIF data of the second frame
im = Image.open("Tests/images/sugarshack_frame_size.mpo")
self.assertEqual(im.size, (640, 480))

im.seek(1)
self.assertEqual(im.size, (680, 480))

def test_parallax(self):
# Nintendo
im = Image.open("Tests/images/sugarshack.mpo")
exif = im.getexif()
self.assertEqual(exif.get_ifd(0x927c)[0x1101]["Parallax"], -44.798187255859375)

# Fujifilm
im = Image.open("Tests/images/fujifilm.mpo")
im.seek(1)
exif = im.getexif()
self.assertEqual(exif.get_ifd(0x927c)[0xb211], -3.125)

def test_mp(self):
for test_file in test_files:
im = Image.open(test_file)
Expand Down
Loading

0 comments on commit 2f13422

Please sign in to comment.