From 0651be97f1321e9b18d1ac0514d1902cc1a8d96e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 8 Jan 2019 21:04:03 +0100 Subject: thirds --- crop-thirds.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'crop-thirds.py') diff --git a/crop-thirds.py b/crop-thirds.py index ebb9f48..7dd23e8 100644 --- a/crop-thirds.py +++ b/crop-thirds.py @@ -33,6 +33,7 @@ src_height = 512 dst_width = int(src_width / opt.count) dst_height = int(dst_width / opt.aspect) dst_size = (dst_width, dst_height,) +y0 = opt.vertical_offset - dst_height / 2 crops = [] paths = [] @@ -40,15 +41,12 @@ paths = [] for i in range(opt.count): x = int(i / opt.count * dst_width) crops.append((x, y0, x + dst_width, y0 + dst_height,)) - paths.append(os.path.join(opt.out_dir, opt.label, chr(97 + i))) - -y0 = opt.vertical_offset - dst_height / 2 - -for path in paths: + path = os.path.join(opt.out_dir, opt.label, chr(97 + i)) if opt.clobber: if os.path.exists(path): rmtree(path) os.makedirs(path) + paths.append(path) dataset = [] for i, fn in enumerate(sorted(glob.glob(os.path.join(opt.folder, '*.png')))): -- cgit v1.2.3-70-g09d2