ianb at colorstudy.com
Wed Jul 9 17:38:04 CEST 2003
On Wed, 2003-07-09 at 09:22, Steffen Brodowski wrote:
> > have that function return the image object. Then, assuming you are
> > doing this in CGI (easily adapted if not), do something like (untested):
> > import sys
> > image = CreateBarCode(...)
> > print 'Content-type: image/jpeg\n'
> > image.save(sys.stdout, 'JPEG')
> I think its more difficult.
> The function CreateBarcode has to return the image directly.
> Additional you have to know, that I have to implement it into Zope. So
> I use the script as an "external method". Modulname=Barcode,
> I'm using the following line in Zope DTML
> <dtml-var "barcode(SourceString='123456789',Linewidth=1,WriteText=0)">
So then you don't want to stream it. You might do something like:
from cStringIO import StringIO
# create image object
output = StringIO()
More information about the Python-list