Skip to content

Commit

Permalink
Upgrade pillow to 5.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
agschwender committed Jul 27, 2018
1 parent eb2e4bb commit 7b65485
Show file tree
Hide file tree
Showing 209 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ before_install:
- sudo apt-get install libwebp-dev liblcms2-dev
- sudo apt-get install python-numpy python-opencv python-pycurl
install:
- pip install tornado==5.1.0 Pillow==2.9.0 coveralls
- pip install tornado==5.1.0 Pillow==5.2.0 coveralls
- pip install pep8==1.6.2 pyflakes==0.8.1
before_script:
- pep8 --exclude=test pilbox
Expand Down
18 changes: 12 additions & 6 deletions pilbox/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,21 +268,27 @@ def save(self, **kwargs):
save_kwargs["exif"] = self._exif

color = color_hex_to_dec_tuple(opts["background"])

if self.img.mode == "RGBA":
self._background(fmt, color)

if fmt == "JPEG":
if self.img.mode == "P":
# Converting old GIF and PNG files to JPEG can raise
# IOError: cannot write mode P as JPEG
# https://mail.python.org/pipermail/python-list/2000-May/036017.html
self.img = self.img.convert("RGB")
elif self.img.mode == "RGBA":
# JPEG does not have an alpha channel so cannot be
# saved as RGBA. It must be converted to RGB.
self.img = self.img.convert("RGB")

if self._orig_format == "JPEG":
self.img.format = self._orig_format
save_kwargs["subsampling"] = "keep"
if opts["quality"] == "keep":
save_kwargs["quality"] = "keep"

if fmt == "JPEG" and self.img.mode == 'P':
# Converting old GIF and PNG files to JPEG can raise
# IOError: cannot write mode P as JPEG
# https://mail.python.org/pipermail/python-list/2000-May/036017.html
self.img = self.img.convert("RGB")

try:
self.img.save(outfile, fmt, **save_kwargs)
except IOError as e:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pilbox/test/data/expected/example-500x400-mode=adapt-retain=80.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 modified pilbox/test/data/expected/example-500x400-mode=clip.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 modified pilbox/test/data/expected/example-500x400-mode=crop.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pilbox/test/data/expected/example-500x400-mode=scale.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 modified pilbox/test/data/expected/test space-400x300-mode=adapt.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 modified pilbox/test/data/expected/test-advanced-125x-mode=adapt.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 modified pilbox/test/data/expected/test-advanced-125x-mode=clip.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 modified pilbox/test/data/expected/test-advanced-125x-mode=crop.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 modified pilbox/test/data/expected/test-advanced-125x-mode=fill.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 modified pilbox/test/data/expected/test-advanced-125x-mode=scale.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pilbox/test/data/expected/test-advanced-125x75-mode=crop.gif
Binary file modified pilbox/test/data/expected/test-advanced-125x75-mode=crop.jpeg
Binary file modified pilbox/test/data/expected/test-advanced-125x75-mode=crop.jpg
Binary file modified pilbox/test/data/expected/test-advanced-125x75-mode=crop.png
Binary file modified pilbox/test/data/expected/test-advanced-125x75-mode=crop.tiff
Binary file not shown.
Binary file modified pilbox/test/data/expected/test-advanced-125x75-mode=crop.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test-advanced-x125-mode=adapt.jpg
Binary file modified pilbox/test/data/expected/test-advanced-x125-mode=clip.jpg
Binary file modified pilbox/test/data/expected/test-advanced-x125-mode=crop.jpg
Binary file modified pilbox/test/data/expected/test-advanced-x125-mode=fill.jpg
Binary file modified pilbox/test/data/expected/test-advanced-x125-mode=scale.jpg
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified pilbox/test/data/expected/test-bad-exif-rotate-degree=auto.jpg
Binary file modified pilbox/test/data/expected/test-orientation-exif-preserve_exif=0.jpg
Binary file modified pilbox/test/data/expected/test-orientation-exif-preserve_exif=1.jpg
Binary file modified pilbox/test/data/expected/test-p-mode-100x100-mode=crop.jpeg
Binary file modified pilbox/test/data/expected/test1-100x200-mode=adapt.jpg
Binary file modified pilbox/test/data/expected/test1-100x200-mode=clip.jpg
Binary file modified pilbox/test/data/expected/test1-100x200-mode=crop.jpg
Binary file modified pilbox/test/data/expected/test1-100x200-mode=fill.jpg
Binary file modified pilbox/test/data/expected/test1-100x200-mode=scale.jpg
Binary file modified pilbox/test/data/expected/test1-300x300-mode=adapt.jpg
Binary file modified pilbox/test/data/expected/test1-300x300-mode=clip.jpg
Binary file modified pilbox/test/data/expected/test1-300x300-mode=crop.jpg
Binary file modified pilbox/test/data/expected/test1-300x300-mode=fill.jpg
Binary file modified pilbox/test/data/expected/test1-300x300-mode=scale.jpg
Binary file modified pilbox/test/data/expected/test1-400x300-mode=adapt.jpg
Binary file modified pilbox/test/data/expected/test1-400x300-mode=clip.jpg
Binary file modified pilbox/test/data/expected/test1-400x300-mode=crop.jpg
Binary file modified pilbox/test/data/expected/test1-400x300-mode=fill.jpg
Binary file modified pilbox/test/data/expected/test1-400x300-mode=scale.jpg
Binary file modified pilbox/test/data/expected/test1-region-rect=150,150,100,100.jpg
Binary file modified pilbox/test/data/expected/test1-region-rect=200,175,50,50.jpg
Binary file modified pilbox/test/data/expected/test1-rotate-degree=180-expand=1.jpg
Binary file modified pilbox/test/data/expected/test1-rotate-degree=180.jpg
Binary file modified pilbox/test/data/expected/test1-rotate-degree=315-expand=1.jpg
Binary file modified pilbox/test/data/expected/test1-rotate-degree=315.jpg
Binary file modified pilbox/test/data/expected/test1-rotate-degree=90-expand=1.jpg
Binary file modified pilbox/test/data/expected/test1-rotate-degree=90.jpg
Binary file modified pilbox/test/data/expected/test1-rotate-degree=auto.jpg
Binary file modified pilbox/test/data/expected/test2-100x200-mode=adapt.png
Binary file modified pilbox/test/data/expected/test2-100x200-mode=clip.png
Binary file modified pilbox/test/data/expected/test2-100x200-mode=crop.png
Binary file modified pilbox/test/data/expected/test2-100x200-mode=fill.png
Binary file modified pilbox/test/data/expected/test2-100x200-mode=scale.png
Binary file modified pilbox/test/data/expected/test2-300x300-mode=adapt.png
Binary file modified pilbox/test/data/expected/test2-300x300-mode=clip.png
Binary file modified pilbox/test/data/expected/test2-300x300-mode=crop.png
Binary file modified pilbox/test/data/expected/test2-300x300-mode=fill.png
Binary file modified pilbox/test/data/expected/test2-300x300-mode=scale.png
Binary file modified pilbox/test/data/expected/test2-400x300-mode=adapt.png
Binary file modified pilbox/test/data/expected/test2-400x300-mode=clip.png
Binary file modified pilbox/test/data/expected/test2-400x300-mode=fill.png
Binary file modified pilbox/test/data/expected/test2-400x300-mode=scale.png
Binary file modified pilbox/test/data/expected/test3-100x200-mode=adapt.jpg
Binary file modified pilbox/test/data/expected/test3-100x200-mode=clip.jpg
Binary file modified pilbox/test/data/expected/test3-100x200-mode=crop.jpg
Binary file modified pilbox/test/data/expected/test3-100x200-mode=fill.jpg
Binary file modified pilbox/test/data/expected/test3-100x200-mode=scale.jpg
Binary file modified pilbox/test/data/expected/test3-300x300-mode=adapt.jpg
Binary file modified pilbox/test/data/expected/test3-300x300-mode=clip.jpg
Binary file modified pilbox/test/data/expected/test3-300x300-mode=crop.jpg
Binary file modified pilbox/test/data/expected/test3-300x300-mode=fill.jpg
Binary file modified pilbox/test/data/expected/test3-300x300-mode=scale.jpg
Binary file modified pilbox/test/data/expected/test3-400x300-mode=adapt.jpg
Binary file modified pilbox/test/data/expected/test3-400x300-mode=clip.jpg
Binary file modified pilbox/test/data/expected/test3-400x300-mode=crop.jpg
Binary file modified pilbox/test/data/expected/test3-400x300-mode=fill.jpg
Binary file modified pilbox/test/data/expected/test3-400x300-mode=scale.jpg
Binary file modified pilbox/test/data/expected/test4-100x200-mode=adapt.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test4-100x200-mode=clip.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test4-100x200-mode=crop.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test4-100x200-mode=fill.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test4-100x200-mode=scale.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified pilbox/test/data/expected/test4-300x300-mode=adapt.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test4-300x300-mode=clip.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test4-300x300-mode=crop.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test4-300x300-mode=fill.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test4-300x300-mode=scale.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test4-400x300-mode=adapt.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test4-400x300-mode=clip.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test4-400x300-mode=crop.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test4-400x300-mode=fill.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test4-400x300-mode=scale.webp
Binary file not shown.
Binary file modified pilbox/test/data/expected/test5-100x200-mode=adapt.gif
Binary file modified pilbox/test/data/expected/test5-100x200-mode=clip.gif
Binary file modified pilbox/test/data/expected/test5-100x200-mode=crop.gif
Binary file modified pilbox/test/data/expected/test5-100x200-mode=fill.gif
Binary file modified pilbox/test/data/expected/test5-100x200-mode=scale.gif
Binary file modified pilbox/test/data/expected/test5-300x300-mode=adapt.gif
Binary file modified pilbox/test/data/expected/test5-300x300-mode=clip.gif
Binary file modified pilbox/test/data/expected/test5-300x300-mode=crop.gif
Binary file modified pilbox/test/data/expected/test5-300x300-mode=fill.gif
Binary file modified pilbox/test/data/expected/test5-300x300-mode=scale.gif
Binary file modified pilbox/test/data/expected/test5-400x300-mode=adapt.gif
Binary file modified pilbox/test/data/expected/test5-400x300-mode=clip.gif
Binary file modified pilbox/test/data/expected/test5-400x300-mode=crop.gif
Binary file modified pilbox/test/data/expected/test5-400x300-mode=fill.gif
Binary file modified pilbox/test/data/expected/test5-400x300-mode=scale.gif
Binary file modified pilbox/test/data/expected/test6-100x200-mode=adapt.tif
Binary file not shown.
Binary file modified pilbox/test/data/expected/test6-100x200-mode=clip.tif
Binary file not shown.
Binary file modified pilbox/test/data/expected/test6-100x200-mode=crop.tif
Binary file not shown.
Binary file modified pilbox/test/data/expected/test6-100x200-mode=fill.tif
Binary file not shown.
Binary file modified pilbox/test/data/expected/test6-100x200-mode=scale.tif
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified pilbox/test/data/expected/test6-300x300-mode=adapt.tif
Binary file not shown.
Binary file modified pilbox/test/data/expected/test6-300x300-mode=clip.tif
Binary file not shown.
Binary file modified pilbox/test/data/expected/test6-300x300-mode=crop.tif
Binary file not shown.
Binary file modified pilbox/test/data/expected/test6-300x300-mode=fill.tif
Binary file not shown.
Binary file modified pilbox/test/data/expected/test6-300x300-mode=scale.tif
Binary file not shown.
Binary file modified pilbox/test/data/expected/test6-400x300-mode=adapt.tif
Binary file not shown.
Binary file modified pilbox/test/data/expected/test6-400x300-mode=clip.tif
Binary file not shown.
Binary file modified pilbox/test/data/expected/test6-400x300-mode=crop.tif
Binary file not shown.
Binary file modified pilbox/test/data/expected/test6-400x300-mode=fill.tif
Binary file not shown.
Binary file modified pilbox/test/data/expected/test6-400x300-mode=scale.tif
Binary file not shown.
4 changes: 4 additions & 0 deletions pilbox/test/image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from pilbox import errors
from pilbox.image import color_hex_to_dec_tuple, Image


try:
import cv
except ImportError:
Expand Down Expand Up @@ -321,6 +322,9 @@ def test_invalid_color_hex_to_dec_tuple(self):

def test_save_failure(self):
img = Image(os.path.join(DATADIR, 'test5.gif'))
def _mock_save(*args, **kwargs):
raise IOError('foo')
img.img.save = _mock_save
self.assertRaises(errors.ImageSaveError,
lambda: img.save(format="webp"))

Expand Down
2 changes: 1 addition & 1 deletion provisioning/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
version={{ item.version }}
use_mirrors=yes
with_items:
- { name: 'Pillow', version: '2.9.0' }
- { name: 'Pillow', version: '5.2.0' }
- { name: 'tornado', version: '5.1.0' }
- { name: 'coverage', version: '3.6' }
- { name: 'pep8', version: '1.6.2' }
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def run(self):
'pilbox': ['frontalface.xml'],
},
install_requires=[
'Pillow==2.9.0',
'tornado==5.1.0',
'Pillow==5.2.0',
'sphinx-me==0.2.1',
],
extras_require = {
Expand Down

0 comments on commit 7b65485

Please sign in to comment.