python - Insert an image base 64 on excel using xlwt -


hello workin in odoo , save images base64 on database. have code, making excel report need put image, excel driver xlwt, can't find nice method.

image = product_id.image_smal (this base64) 

on web found this:

xlwt.insert_bitmap('path', row, col) 

and this:

fh = open("imagetosave.png", "wb") fh.write(imgdata.decode('base64')) fh.close() 

i can save image not inserted , give me error:

bitmap doesn't appear to valid bitmap image. 

thank help.

to convert png bmp need to:

from pil import image  img = image.open("imagetosave.png") r, g, b, = img.split() img = image.merge("rgb", (r, g, b)) img.save('imagetoadd.bmp') xlwt.insert_bitmap('imagetoadd.bmp', row, col) 

hope help!!


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -