[Image-SIG] AGG-based drawing for PIL
Fredrik Lundh
fredrik at pythonware.com
Wed Oct 26 12:16:42 CEST 2005
Stani wrote:
> Any chance for a cross-platform solution?
aggdraw in itself is cross-platform. if you're not on Windows, or prefer
to write portable code, you can either use tostring() or PIL to transfer
the images from aggdraw's internal buffer to the format used by the UI
toolkit you're using.
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())
should work.
</F>
More information about the Image-SIG
mailing list