How to insert image into a reportlab table

An update on below. Really I have moved on but I will leave the original problem below. The syntax I’m using now is

WATImage = pdfimages.PDFImage('Wat32x32.jpg',0,0)
OnceMore = WATImage.drawInlineImage(c)

#populate data for the table
#create first row of table
data= [['', 'GP','DSTB', 'LSTB', 'CPit', OnceMore, 'KAM', 'GM']]

This places the image in a random(?) place on the document and puts the string “True” in the place where the graphic should be.


No longer relevant. Left for documentation.
I’m pulling my hair out over something that should be so simple. I’m trying to show an image in a table.

WATImage = PIL.Image.open('Wat32x32.jpg')

Creates this

<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=32x32 at 0x7F3C142EC730>

but calling

only displays that literal not the image itself. I did try with c.drawInlineImage but that generated

AttributeError: 'int' object has no attribute 'wrapOn'

What is the proper syntax to insert the actual image not the object refernce.

Thanks,
Brian

An old post, but I came across it when searching for something else.

I’m not well versed in ReportLab, but shouldn’t your draw call be
OnceMore = c.drawInlineImage(WATImage)? Assuming you did c = Canvas(‘’.pdf’')…

My thought is you should also be using drawImage instead of InlineImage.

And you’re missing the last bit of code above the AttributeError: so I cannot say. What it does remind me of is calling PIL is similar to Matplot where you have to show the image, not the PIL object?