mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
29 lines
847 B
Python
29 lines
847 B
Python
# -*- coding: utf-8 -*-
|
|
import PIL.Image
|
|
|
|
# check for JPEG support.
|
|
try:
|
|
PIL.Image._getdecoder("rgb", "jpeg", None)
|
|
except IOError as e:
|
|
if str(e).startswith("decoder jpeg not available"):
|
|
raise Exception(
|
|
"FATAL: jpeg codec not supported. Install pillow correctly! "
|
|
" 'sudo apt-get install libjpeg-dev' then 'pip install -I pillow'"
|
|
)
|
|
except Exception:
|
|
# any other exception is fine
|
|
pass
|
|
|
|
|
|
# check for PNG support.
|
|
try:
|
|
PIL.Image._getdecoder("rgb", "zip", None)
|
|
except IOError as e:
|
|
if str(e).startswith("decoder zip not available"):
|
|
raise Exception(
|
|
"FATAL: zip codec not supported. Install pillow correctly! "
|
|
" 'sudo apt-get install libjpeg-dev' then 'pip install -I pillow'"
|
|
)
|
|
except Exception:
|
|
# any other exception is fine
|
|
pass |