[reportlab-users] Problem with renderPM.saveToFile; how to output .PNG?

Robin Becker reportlab-users@reportlab.com
Tue, 19 Aug 2003 09:06:41 +0100

In article <20030818205947.1ef7d387.waxmop@gtcinternet.com>, waxmop
<waxmop@gtcinternet.com> writes
>I should have mentioned that I want/need to save a Drawing object to a
>.PNG file.  I'm having no luck at all getting data out as .png.  Can you
>walk through a trivial example where you create a simple 'hello world'
>drawing object, then save the output to a bunch of different formats?
>It would be super-helpful.

Here's a simple test drawing that does exactly what you want. Change
the filename root(fnRoot) and/or the output directory(outDir) to suit

#Autogenerated by ReportLab guiedit do not edit
from reportlab.graphics.charts.piecharts import Pie3d
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin

class TestDrawing000(_DrawingEditorMixin,Drawing):
        def __init__(self,width=400,height=200,*args,**kw):
                self.contents[0].x            = 25

if __name__=="__main__": #NORUNTESTS

Robin Becker