From 34f363f90341f321cf2cc0d3278e99b036951362 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 24 Oct 2017 17:50:19 +0200 Subject: [PATCH] tools: add optional output parameter to toi2png --- tools/toi2png | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/toi2png b/tools/toi2png index b682885e..ff786154 100755 --- a/tools/toi2png +++ b/tools/toi2png @@ -23,7 +23,7 @@ def process_grayscale(w, h, data): return bytes(pix) -def process_image(ifn): +def process_image(ifn, ofn): data = open(ifn, 'rb').read() @@ -38,7 +38,8 @@ def process_image(ifn): else: print('Unsupported format') return 3 - ofn = '%s.png' % ifn[:-5] + if ofn is None: + ofn = '%s.png' % ifn[:-5] w, h = struct.unpack(' 2 else None + process_image(ifn, ofn) main()