diff --git a/pydenticon/__init__.py b/pydenticon/__init__.py index 0edfdb02d25ee603310ffa465273550e746eda06..f499988266fc099ad9aa49ab50e8d259440d7dc8 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)