diff options
-rw-r--r-- | pydenticon/__init__.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pydenticon/__init__.py b/pydenticon/__init__.py index 0edfdb0..f499988 100644 --- a/pydenticon/__init__.py +++ b/pydenticon/__init__.py @@ -246,6 +246,9 @@ class Generator(object): # Set-up a stream where image will be saved. stream = BytesIO() + if image_format.upper() == "JPEG": + image = image.convert(mode="RGB") + # Save the image to stream. try: image.save(stream, format=image_format, optimize=True) |