Now cut lines are drawn.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Fri, 28 Jun 2019 19:34:52 +0000 (21:34 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Fri, 28 Jun 2019 20:52:51 +0000 (22:52 +0200)
gimp_passport.py

index ff9a00e..925e483 100644 (file)
@@ -200,6 +200,12 @@ def main(paper_width_mm: float, paper_height_mm: float, paper_margin_mm: float,
     img = Image.open(source_image)
     photo = make_passport(img, bbox, 0.75, photo_width_mm, photo_height_mm)
     paper = tile(photo, paper_width_mm, paper_height_mm, paper_margin_mm, photo_spacing_mm)
+    dpi = paper.info['dpi'][0]
+    margin = mm_to_pixel(paper_margin_mm, dpi)
+    spacing = mm_to_pixel(photo_spacing_mm, dpi)
+    count_x = num_tiles(paper.width, photo.width, margin, spacing)
+    count_y = num_tiles(paper.height, photo.height, margin, spacing)
+    cut_lines_xy(paper, count_x, count_y, photo.size, margin, spacing)
     paper = downsample_large(paper, max_dpi)
     paper.save(dest_image, dpi=paper.info['dpi'])