Handle exception from pillow (#16190)

This commit is contained in:
PhracturedBlue authored and Paulus Schoutsen committed 2018-08-26 22:51:17 +02:00
1 parent 2ece671bfd
commit 6992a6fe6d
1 file changed
+4 -1
+4 -1
View File
@@ -64,7 +64,10 @@ def _resize_image(image, opts):
quality = opts.quality or DEFAULT_QUALITY
new_width = opts.max_width
img = Image.open(io.BytesIO(image))
try:
img = Image.open(io.BytesIO(image))
except IOError:
return image
imgfmt = str(img.format)
if imgfmt not in ('PNG', 'JPEG'):
_LOGGER.debug("Image is of unsupported type: %s", imgfmt)