From 5ef872b876bc7c6414686bfc04cc39b821d796fc Mon Sep 17 00:00:00 2001 From: "Alex J. Champandard" Date: Sun, 30 Oct 2016 20:45:10 +0100 Subject: [PATCH] Add warning for files that may be too large for 4x. --- enhance.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/enhance.py b/enhance.py index 0a98c66..23ca9d2 100755 --- a/enhance.py +++ b/enhance.py @@ -516,6 +516,12 @@ if __name__ == "__main__": else: for filename in args.files: print(filename) - out = enhancer.process(scipy.ndimage.imread(filename, mode='RGB')) + img = scipy.ndimage.imread(filename, mode='RGB') + if img.shape[0] * img.shape[1] > 256 ** 2 and args.scales >= 2: + error('This file is (probably) too large to process in one shot and was ignored.', + ' - Until tiled rendering is added, edit this code at your own peril!') + continue + + out = enhancer.process(img) out.save(os.path.splitext(filename)[0]+'_ne%ix.png'%(2**args.scales)) print(ansi.ENDC)