Downsample as first step, not last step.
[toast/gimp_passport.git] / gimp_passport.py
index 4da72c7..cccdeff 100644 (file)
@@ -169,6 +169,7 @@ def process(paper_width_mm: float, paper_height_mm: float, paper_margin_mm: floa
     :param fpr: face to picture ratio, e.g. 2/3
     """
     passport_tile = make_passport(source_image, bbox, fpr, photo_width_mm, photo_height_mm)
+    passport_tile = downsample_large(passport_tile, max_dpi)
     dpi = passport_tile.info['dpi'][0]
     paper = Image.new('RGB', (mm_to_pixel(paper_width_mm, dpi), mm_to_pixel(paper_height_mm, dpi)), 'white')
     paper.info['dpi'] = (dpi, dpi)
@@ -179,7 +180,7 @@ def process(paper_width_mm: float, paper_height_mm: float, paper_margin_mm: floa
     cut_lines_xy(paper, columns, rows, passport_tile.size, margin, spacing)
     halo(paper, columns, rows, passport_tile.size, 1, margin, spacing)
     tile(paper, passport_tile, columns, rows, margin, spacing)
-    return downsample_large(paper, max_dpi)
+    return paper
 
 
 def main(paper_width_mm: float, paper_height_mm: float, paper_margin_mm: float,