Hi guys, I have a png file created by Gnuplot that I need to put in an excel document using XLWT.
XLWT cannot import PNG into a document, only BMP, so I need to convert PNG first. I used PIL for this.
Here is the relevant code:
im = Image.open('%s' % os.path.join(os.getcwd(), s + '.png')) im.save('%s.bmp' % s)
However, XLWT gives me this error:
Exception: bitmap isn't a 24bit true color bitmap.
Here is what the XLWT code looks like:
self.chart.insert_bitmap(path, 2, 2)
I know that both images work fine, they open with windows. I also tried adding a pause of 2 seconds after creating the BMP (to compensate for the recording time), but it still doesn't work.
How do I make a 24-bit bitmap with true color using PIL?
source share