Feat: use ration in one_centered
This commit is contained in:
parent
27e5c52548
commit
58edb87ebc
@ -15,7 +15,8 @@ photobook.set_auto_page_break(False)
|
|||||||
|
|
||||||
photobook.set_fig_folder("textures")
|
photobook.set_fig_folder("textures")
|
||||||
photobook.one_centered("eugene.jpg", "one_centered default")
|
photobook.one_centered("eugene.jpg", "one_centered default")
|
||||||
photobook.one_centered("eugene.jpg", "one_centered part_of_text=2", part_of_text=2)
|
photobook.one_centered("eugene.jpg", "")
|
||||||
|
photobook.one_centered("eugene.jpg", "one_centered text_ratio=1, img_ratio=1", text_ratio=1, img_ratio=1)
|
||||||
|
|
||||||
|
|
||||||
photobook.output(dest)
|
photobook.output(dest)
|
||||||
|
@ -109,15 +109,14 @@ class Photobook(FPDF):
|
|||||||
self,
|
self,
|
||||||
img,
|
img,
|
||||||
text="",
|
text="",
|
||||||
part_of_text=6,
|
img_ratio=5,
|
||||||
|
text_ratio=1,
|
||||||
):
|
):
|
||||||
"""Display the picture centered with text below"""
|
"""Display the picture centered with text below"""
|
||||||
self.add_page()
|
self.add_page()
|
||||||
|
|
||||||
if text == "":
|
total_ratio = img_ratio + text_ratio
|
||||||
text_size = (0, 0)
|
text_size = (self.epw, (self.eph - self.sep) * text_ratio / total_ratio - self.sep)
|
||||||
else:
|
|
||||||
text_size = (self.epw, (self.eph - self.sep) / part_of_text - self.sep)
|
|
||||||
|
|
||||||
img_size = (self.epw, self.eph - text_size[1])
|
img_size = (self.epw, self.eph - text_size[1])
|
||||||
img_dest = self.img_process(img, img_size)
|
img_dest = self.img_process(img, img_size)
|
||||||
|
Loading…
Reference in New Issue
Block a user