[Image-SIG] PSDraw in PIL problem with print
Sajjad Hussain
shussai2 at yahoo.com
Mon Apr 17 19:49:18 CEST 2006
Hi,
I am trying to follow the Postscript print example in
PIL. So I am using PSDraw to create a new ps file from
a jpeg. I have ghostview installed, so I can view the
resulting ps file (when it is produced successfully).
Example from PIL Manual:
import Image, PSDraw
im = Image.open('lena.jpg').convert('L')
box = (1*72, 2*72, 7*72, 10*72)
outfp = open('lena.ps','w')
ps = PSDraw.PSDraw(outfp)
ps.begin_document()
ps.image(box,im,72)
ps.rectangle(box)
ps.end_document()
Now when I try to open up the lena.ps (that should
contain the lena.jpg) in ghostview, I get Error:
undefined gsize. However when I change the gsize to
gsave in the lena.ps, the file loads up. Snippet of
the actual code is show below:
%%EndProlog
gsize ------------------> change this to gsave
240.000000 384.000000 translate
0.960000 0.960000 scale
gsave
I don't know why it is happening. Can you please tell
me another solution instead of changing a line
manually.
I just need to print a jpeg file. Is there any way
else to do this. So basically I have an image in a
folder, I open it and send it to a printer.
Please let me know if you guys know anything.
Regards,
Sajjad
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Image-SIG
mailing list