これが私がウェブ上の2つの異なるリンクから見つけたもので、私にとっては完璧に機能しました。Matplotlibでは、ここで使用するpngファイルを保存できます。
from PIL import Image
file_in = "image.png"
img = Image.open(file_in)
file_out = 'test1.bmp'
print len(img.split()) # test
if len(img.split()) == 4:
# prevent IOError: cannot write mode RGBA as BMP
r, g, b, a = img.split()
img = Image.merge("RGB", (r, g, b))
img.save(file_out)
else:
img.save(file_out)
from xlwt import Workbook
w = Workbook()
ws = w.add_sheet('Image')
ws.insert_bitmap(file_out, 0, 0)
w.save('images.xls')
コードの画像部分は、ここhttp://www.daniweb.com/software-development/python/threads/253957/converting-an-image-file-png-to-a-bitmap-fileからのEneUrans応答からのものです。
xlwtは、http: //www.simplistix.co.uk/presentations/python-excel.pdfで見つけたxlwtのドキュメントを単に形成したものです。