Call PIL.Image.init to register all formats (fix #474)

This commit is contained in:
Simon Conseil
2022-08-02 17:00:31 +02:00
parent 35d42e9904
commit ce139ed46a
2 changed files with 9 additions and 6 deletions

View File

@@ -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()}

10
tox.ini
View File

@@ -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