Ajuster le collage des autocollants (espacement et labels visibles)
This commit is contained in:
parent
fc8feec5d9
commit
1d3c035978
@ -46,11 +46,13 @@ def plot_sticker_sheets(
|
||||
|
||||
labels = [f"{row['year']} • {row['set_id']} • {row['part_num']}" for row in selected]
|
||||
text_height = max(measure(label)[1] for label in labels)
|
||||
max_width = max(img.width for img in images)
|
||||
max_height = max(img.height for img in images)
|
||||
|
||||
columns = max(1, columns)
|
||||
rows_count = (len(images) + columns - 1) // columns
|
||||
cell_width = 280
|
||||
cell_height = 220 + text_height + 12
|
||||
cell_width = max(max_width + 40, 240)
|
||||
cell_height = max_height + text_height + 20
|
||||
width = columns * cell_width
|
||||
height = rows_count * cell_height
|
||||
canvas = Image.new("RGBA", (width, height), (255, 255, 255, 255))
|
||||
@ -59,7 +61,7 @@ def plot_sticker_sheets(
|
||||
col = index % columns
|
||||
row_idx = index // columns
|
||||
x = col * cell_width + (cell_width - img.width) // 2
|
||||
y = row_idx * cell_height + 8
|
||||
y = row_idx * cell_height + 6
|
||||
canvas.paste(img, (x, y), img)
|
||||
text_width, _ = measure(label)
|
||||
text_x = col * cell_width + (cell_width - text_width) // 2
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user