diff --git a/main.py b/main.py index 694c3ca..28afc1e 100644 --- a/main.py +++ b/main.py @@ -474,7 +474,7 @@ answer = "Answer: " + "; ".join(problem['problem']['content']['answer']) - image = Image.open(f"{DOWNLOAD_FOLDER}/{name_prefix}/{problem['index']}.jpg") + image = Image.open(f"{DOWNLOAD_FOLDER}/{name_prefix}/{problem['index']}.jpg").convert("RGB") draw = ImageDraw.Draw(image) @@ -488,7 +488,7 @@ # Draw the text on top (white) draw.text((text_bbox[0], text_bbox[1]), answer, anchor="lt", font=font, fill="#333") - image.convert(mode="RGB").save(f"{DOWNLOAD_FOLDER}/{name_prefix}/{problem['index']}-ans.jpg") + image.save(f"{DOWNLOAD_FOLDER}/{name_prefix}/{problem['index']}-ans.jpg") # Replace the image in the list images[images.index(f"{DOWNLOAD_FOLDER}/{name_prefix}/{problem['index']}.jpg")] = f"{DOWNLOAD_FOLDER}/{name_prefix}/{problem['index']}-ans.jpg"