Commit 34a3c31c authored by Paulo Miguel Almeida's avatar Paulo Miguel Almeida

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

parent 0d1e1503
......@@ -150,12 +150,13 @@ def detect_orientation(image, lang=None):
if lang is not None:
command += ['-l', lang]
image = image.convert("RGB")
if image.mode != "RGB":
image = image.convert("RGB")
proc = subprocess.Popen(command, stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
image.save(proc.stdin, format='png')
image.save(proc.stdin, format=image.format)
proc.stdin.close()
output = proc.stdout.read()
proc.wait()
......
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