[reportlab-users] Image within a table - Preserve Aspect Ratio
Maxim Danilov
info at twinboards.at
Sat Feb 23 15:14:44 EST 2019
hi Larissa.
If I have correctly understand, i think you break yours "IMAGE Aspect Ratio” in line:
maxIMAGE = platy.Image(maxIMAGE_path,2.2*inch, 2.2*inch)
Don’t matter that you have: jpeg 2x3 or png 100x1 you set it like img 2.2x2.2 always.
If you try to see in flowables.py <https://fossies.org/dox/reportlab-3.5.13/flowables_8py.html>, class Image <https://fossies.org/dox/reportlab-3.5.13/classreportlab_1_1platypus_1_1flowables_1_1Image.html>(Flowable <https://fossies.org/dox/reportlab-3.5.13/classreportlab_1_1platypus_1_1flowables_1_1Flowable.html>):
def __init__ <https://fossies.org/dox/reportlab-3.5.13/classreportlab_1_1platypus_1_1flowables_1_1Image.html#a6e8d7de8469646f51b23cc9d37f9dca3>( … width=None, height=None, … )
You can give only one dimensions or don’t give nothing.
Image.draw() should calculate all himself.
But I always like to do a little more comfortable.
I override platy.Image. with a New_class
For my new class I give in init also max-height and max-width. it help me to transform Image before draw, how I want.
Mit freundlichen Grüßen,
DI Mag. Maxim Danilov
+43(681)207 447 76
info at twinboards.at
> On 23.02.2019, at 07:39, reportlab-users-request at lists2.reportlab.com wrote:
>
> maxIMAGE = platy.Image(maxIMAGE_path,2.2*inch, 2.2*inch)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20190223/ee7bd3c7/attachment.html>
More information about the reportlab-users
mailing list