diff --git a/robotoff/app/api.py b/robotoff/app/api.py index a486c449e6..998a6c5ce4 100644 --- a/robotoff/app/api.py +++ b/robotoff/app/api.py @@ -949,6 +949,9 @@ def on_get(self, req: falcon.Request, resp: falcon.Response): def image_response(image: Image.Image, resp: falcon.Response) -> None: resp.content_type = "image/jpeg" fp = io.BytesIO() + # JPEG doesn't support RGBA, so we convert to RGB if needed + if image.mode != "RGB": + image = image.convert("RGB") image.save(fp, "JPEG") stream_len = fp.tell() fp.seek(0)