Browse Source

Merge pull request #479 from saimn/update-pillow

Updates for recent Pillow changes
pull/480/head
Simon Conseil 4 years ago committed by GitHub
parent
commit
5ee967bf9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      setup.cfg
  2. 5
      sigal/gallery.py
  3. 10
      sigal/image.py
  4. 10
      tox.ini

2
setup.cfg

@ -32,7 +32,7 @@ install_requires =
click
Jinja2>=2.7
Markdown
Pillow>=4.0.0
Pillow>=8.0.0
pilkit
natsort

5
sigal/gallery.py

@ -235,6 +235,9 @@ class Image(Media):
super().__init__(filename, path, settings)
imgformat = settings.get('img_format')
# Register all formats
PILImage.init()
if imgformat and PILImage.EXTENSION[self.src_ext] != imgformat.upper():
# Find the extension that should match img_format
extensions = {v: k for k, v in PILImage.EXTENSION.items()}
@ -492,7 +495,7 @@ class Album:
def sort_key(s):
sort_attr = albums_sort_attr
if not isinstance(sort_attr,list):
sort_attr = [sort_attr]
sort_attr = [sort_attr]
album = self.gallery.albums[join(root_path, s)]

10
sigal/image.py

@ -161,10 +161,16 @@ def generate_thumbnail(
img = Transpose().process(img)
original_format = img.format
try:
method = PILImage.Resampling.LANCZOS
except AttributeError:
# Deprecated since version 9.1.0
method = PILImage.ANTIALIAS
if fit:
img = ImageOps.fit(img, box, PILImage.ANTIALIAS, centering=thumb_fit_centering)
img = ImageOps.fit(img, box, method, centering=thumb_fit_centering)
else:
img.thumbnail(box, PILImage.ANTIALIAS)
img.thumbnail(box, method)
outformat = img.format or original_format or 'JPEG'
logger.debug('Save thumnail image: %s (%s)', outname, outformat)

10
tox.ini

@ -1,19 +1,19 @@
[tox]
envlist = py{38,39,310}-pillow{71,80,-latest},pypy3,check
envlist = py{38,39,310}-pillow{80,90,-latest},pypy3,check
skip_missing_interpreters = true
isolated_build = true
[gh-actions]
python =
3.8: py38-pillow71, check
3.9: py39-pillow80
3.8: py38-pillow80, check
3.9: py39-pillow90
3.10: py310-pillow-latest
pypy3: pypy3
[testenv]
deps =
pillow71: Pillow==7.1.0
pillow80: Pillow==8.0.0
pillow80: Pillow==8.0.1
pillow90: Pillow==9.0.1
extras =
all
tests

Loading…
Cancel
Save