Fix white lines, generate images for border printing
This commit is contained in:
parent
088181085e
commit
b0eabd1297
3 changed files with 49 additions and 27 deletions
|
|
@ -12,7 +12,7 @@ class CardImageTransfer:
|
|||
|
||||
|
||||
class SheetLayout:
|
||||
def __init__(self, dpi: int, w_inches: float, h_inches: float, internal_bleed: bool):
|
||||
def __init__(self, dpi: int, w_mils: int, h_mils: int, internal_bleed: bool, paper_border_mils: int):
|
||||
self.dpi = dpi
|
||||
|
||||
self.card_w_inches = CARD_W_INCHES
|
||||
|
|
@ -20,17 +20,14 @@ class SheetLayout:
|
|||
self.card_w = self.in_to_px(self.card_w_inches)
|
||||
self.card_h = self.in_to_px(self.card_h_inches)
|
||||
|
||||
self.w_inches = w_inches
|
||||
self.h_inches = h_inches
|
||||
self.w = self.in_to_px(self.w_inches)
|
||||
self.h = self.in_to_px(self.h_inches)
|
||||
self.w = self.mil_to_px(w_mils)
|
||||
self.h = self.mil_to_px(h_mils)
|
||||
self.leave_bleed = self.in_to_px(LEAVE_BLEED_INCHES)
|
||||
|
||||
self.spacing_inches = 0.05 if internal_bleed else 0
|
||||
self.spacing = self.in_to_px(self.spacing_inches)
|
||||
|
||||
self.min_padding_inches = 0.12
|
||||
self.min_padding = self.in_to_px(self.min_padding_inches)
|
||||
self.min_padding = self.mil_to_px(paper_border_mils)
|
||||
|
||||
paste_area_left_xs = []
|
||||
paste_area_right_xs = []
|
||||
|
|
@ -124,9 +121,12 @@ class SheetLayout:
|
|||
|
||||
print(self.__dict__)
|
||||
|
||||
def in_to_px(self, inches: float) -> float:
|
||||
def in_to_px(self, inches: float) -> int:
|
||||
return round(inches * self.dpi)
|
||||
|
||||
def mil_to_px(self, mils: int) -> int:
|
||||
return mils * self.dpi // 1000
|
||||
|
||||
def create_card_image_transfer(self, y_index: int, x_index: int) -> CardImageTransfer:
|
||||
top_row = y_index == 0
|
||||
bottom_row = y_index == self.cards_per_column - 1
|
||||
|
|
@ -144,10 +144,14 @@ class SheetLayout:
|
|||
return CardImageTransfer((paste_x, paste_y), bleeds)
|
||||
|
||||
|
||||
def letter_portrait_3x3_sheet_layout() -> SheetLayout:
|
||||
return SheetLayout(1200, 8.5, 11, False)
|
||||
def letter_portrait_3x3_sheet_layout_120milborder() -> SheetLayout:
|
||||
return SheetLayout(1200, 8500 - 2 * 120, 11000 - 2 * 120, False, 0)
|
||||
|
||||
|
||||
def letter_landscape_2x4_sheet_layout() -> SheetLayout:
|
||||
return SheetLayout(1200, 11, 8.5, False)
|
||||
def letter_portrait_3x3_sheet_layout_120milborderless() -> SheetLayout:
|
||||
return SheetLayout(1200, 8500, 11000, False, 120)
|
||||
|
||||
|
||||
def letter_landscape_2x4_sheet_layout_120milborderless() -> SheetLayout:
|
||||
return SheetLayout(1200, 11000, 8500, False, 120)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue