st.brodowski at eucrea.com
Wed Jul 9 16:22:04 CEST 2003
> > import Image, ImageDraw
> > def CreateBarcode(SourceString,Linewidth,WriteText):
> > blablabla
> > ...
> > NewImage = Image.new("L",NewSize,Backcolor)
> > ImgDraw = ImageDraw.Draw(NewImage)
> > ....
> > #How to put the image into an stream?
> 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
<img src="<dtml-var "barcode128(SourceString='123456789',Linewidth=1,WriteText=0)">">
to generate the barcode and for showing it on a html-site.
But is doesn't run.
Do you have any ideas?
More information about the Python-list