|
From: Friedrich R. <fri...@gm...> - 2010-03-21 19:03:50
|
2010/3/20 Ciarán Mooney <gen...@go...>:
> I am using PIL because I plan to plug in a Tkinter interface which can
> directly accept PIL image instances.
You can render matplotlib figures to PIL using following code:
figure.set_size_inches(float(shape[0]) / figure.dpi, float(shape[1]) /
figure.dpi)
canvas = matplotlib.backends.backend_agg.FigureCanvasAgg(figure)
canvas.draw()
image_string = canvas.tostring_rgb()
image = Image.fromstring("RGB", shape, image_string)
fwiw,
Friedrich
|