Commit 0d1e1503 authored by Paulo Miguel Almeida's avatar Paulo Miguel Almeida

Avoid unnecessary convert to RGB and allow using image formats different from PNG

parent e73a78bc
......@@ -98,9 +98,11 @@ def image_to_string(image, lang=None, builder=None):
cmd += ["-o", output_file.name]
cmd += ["-"] # stdin
if image.mode != "RGB":
image = image.convert("RGB")
img_data = BytesIO()
image = image.convert("RGB")
image.save(img_data, format="png")
image.save(img_data, format=image.format)
proc = subprocess.Popen(cmd,
stdin=subprocess.PIPE,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment