Skip to content

Commit

Permalink
fix: put_image() raise 'unknown file extension' error when use PIL …
Browse files Browse the repository at this point in the history
…Image as `src`
  • Loading branch information
wang0618 committed Apr 16, 2021
1 parent 81a9152 commit 4074628
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pywebio/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ def put_image(src, format=None, title='', width=None, height=None,
put_image('https://www.python.org/static/img/python-logo.png')
"""
if isinstance(src, PILImage):
format = src.format
format = format or src.format or 'JPEG'
imgByteArr = io.BytesIO()
src.save(imgByteArr, format=format)
src = imgByteArr.getvalue()
Expand Down

0 comments on commit 4074628

Please sign in to comment.