Skip to content

Commit 0b0fb88

Browse files
authored
fix: OSError when generating JPEG thumbnails from LA mode images (#1198)
1 parent 84a5bbc commit 0b0fb88

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

open_prices/proofs/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ def generate_thumbnail(
9999
image_thumb_full_path = generate_full_path(
100100
current_dir, f"{file_stem}.{settings.THUMBNAIL_SIZE[0]}", extension
101101
)
102-
# avoid 'cannot write mode RGBA as JPEG' error
103-
if mimetype in ("image/jpeg",) and img_thumb.mode in ("RGBA", "P"):
102+
# avoid 'cannot write mode RGBA/LA/P as JPEG' error
103+
if mimetype in ("image/jpeg",) and img_thumb.mode in ("RGBA", "LA", "P"):
104104
img_thumb = img_thumb.convert("RGB")
105105
# save (exif will be stripped)
106106
img_thumb.save(image_thumb_full_path)

0 commit comments

Comments
 (0)