26 lines
531 B
Python
26 lines
531 B
Python
from pathlib import Path
|
|
|
|
CARD_W_INCHES = 2.48031 # 63mm
|
|
CARD_H_INCHES = 3.46457 # 88mm
|
|
|
|
W_INCHES_EXPECTED = 2.72
|
|
H_INCHES_EXPECTED = 3.7
|
|
|
|
LEAVE_BLEED_INCHES = 0.04
|
|
|
|
BASE_DIR = Path(__file__).parent
|
|
|
|
SAVE_INTERMEDIATE_FOR_DEBUG = False
|
|
|
|
|
|
def make_intermediate_name(input_path: Path, infix: str):
|
|
return BASE_DIR / 'cropped_cards' / f'{input_path.stem}.{infix}.jpg'
|
|
|
|
|
|
def in_to_px(inches: float, dpi: int) -> int:
|
|
return round(inches * dpi)
|
|
|
|
|
|
def mil_to_px(mils: int, dpi: int) -> int:
|
|
return int(mils * dpi // 1000)
|
|
|