From 14d766e34e3286f25e15c5fa7523ce025e510ef8 Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Mon, 13 May 2019 17:40:02 +0300 Subject: [PATCH] Fixes detect size if crop whitespace --- resize.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/resize.py b/resize.py index 1338aad..49180ff 100755 --- a/resize.py +++ b/resize.py @@ -22,9 +22,15 @@ try: im = im.convert() if args.width is not None or args.height is not None: if args.width is None: - size = (int(im.size[0] * args.height / im.size[1]), args.height) + if args.crop and args.crop == CROP_WHITESPACE: + size = (int(im.size[0]), args.height) + else: + size = (int(im.size[0] * args.height / im.size[1]), args.height) elif args.height is None: - size = (args.width, int(im.size[1] * args.width / im.size[0])) + if args.crop and args.crop == CROP_WHITESPACE: + size = (args.width, int(im.size[1])) + else: + size = (args.width, int(im.size[1] * args.width / im.size[0])) else: size = (args.width, args.height) if args.crop: