Skip to content

Commit

Permalink
Add stored images
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Oct 29, 2018
1 parent 7ecaa30 commit 77512cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scan
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ def old_crop(img, marging_horizontal=25, maring_vertical=25):
if h <= o_h and w <= o_w:
call(convert + [img, '-crop', '{}x{}+{}+{}'.format(w + 2 * marging_horizontal, h + 2 * maring_vertical, x, y), '+repage', img])


def transform(config):
images = set()
images = list()
os.makedirs(root_folder + '/scantailor')
os.makedirs(root_folder + '/preview')
for img in config['images']:
Expand Down Expand Up @@ -154,6 +155,7 @@ def transform(config):
img2 = root_folder + '/preview/{}.png'.format(name)
subprocess.call(convert + [img, img2])
images.add(img2)
return images

def finalise(config):
images = sorted(images)
Expand Down Expand Up @@ -202,7 +204,7 @@ while True:
ok = False

if ok:
transform(config)
config['images'] = transform(config)

full_name = ' '.join(config['args']['title'])
if config['args']['correspondent'] is not None:
Expand Down

0 comments on commit 77512cd

Please sign in to comment.