[Image-SIG] AGG-based drawing for PIL

Arnd Baecker arnd.baecker at web.de
Wed Oct 26 13:08:22 CEST 2005


On Wed, 26 Oct 2005, Fredrik Lundh wrote:

> for example, you can write portable Tkinter code via PIL's ImageTk layer:
>
>     im = Image.new("RGB", size)
>     draw = aggdraw.Draw(im)
>     ...
>     draw.flush()
>     del draw
>
>     image = ImageTk.PhotoImage(im)
>
> or you can use something like the WCK's ui_image method:
>
>     draw = aggdraw.Draw(mode, size)
>     ...
>     image = self.ui_image(draw.mode, draw.size, draw.tostring())
>
> for wxPython, something like:
>
>     draw = aggdraw.Draw("RGB", size)
>     ...
>     image = wx.EmptyImage(*size)
>     image.SetData(draw.tostring())

Does the ".tostring()" part cost a lot of performance?
I.e. could there be more direct approaches which would be even faster?

(I remember there was some discussion on the matplotlib
mailing list concerning fast conversion of agg buffers to wx, see
http://sourceforge.net/mailarchive/message.php?msg_id=12801822
and the corresponding _wxagg.cpp
http://cvs.sourceforge.net/viewcvs.py/matplotlib/matplotlib/src/_wxagg.cpp?rev=1.1&view=auto
)

Best, Arnd


More information about the Image-SIG mailing list