]> git.parisson.com Git - teleforma.git/commitdiff
fix mode P for jpeg
authorGuillaume Pellerin <guillaume.pellerin@parisson.com>
Mon, 19 Jan 2026 12:52:36 +0000 (13:52 +0100)
committerGuillaume Pellerin <guillaume.pellerin@parisson.com>
Mon, 19 Jan 2026 12:52:36 +0000 (13:52 +0100)
teleforma/forms.py

index ae6615b4c5b0bb06f6f0e0a5a3743d5de9854127..8748f1e4a47cf2630c2d44e48811c9d45c9bc61d 100644 (file)
@@ -144,9 +144,8 @@ class UserForm(ModelForm):
         # resize image
         img = Image.open(image.file)
         new_image = img.resize((NEW_WIDTH, NEW_HEIGHT), Image.LANCZOS)
-        if new_image.mode == "RGBA":
+        if new_image.mode in ("RGBA", "P"):
             new_image = new_image.convert("RGB")
-
         temp = BytesIO()
         new_image.save(temp, 'jpeg')
         temp.seek(0)