Move SheetLayout, make InputCardImage to resize

This commit is contained in:
henriquenakashima 2023-07-10 15:07:22 -04:00
parent 902482abb0
commit 89e20fd61e
4 changed files with 123 additions and 108 deletions

View file

@ -3,6 +3,7 @@ from pathlib import Path
from PIL import Image
from base_proxy import LEAVE_BLEED_INCHES
from sheet_layout import SheetLayout
W_INCHES_EXPECTED = 2.72
@ -33,3 +34,8 @@ class InputCardImage:
cropped_part = rgb_im.crop(crop_box)
return cropped_part
def get_cropped_and_resized(self, sheet_layout: SheetLayout) -> Image:
im = self.crop()
im = im.resize((sheet_layout.cropped_image_dest_w, sheet_layout.cropped_image_dest_h), resample=Image.Resampling.LANCZOS)
return im