ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> image-sig
image-sig
[Image-SIG] PSDraw in PIL problem with print
by Sajjad Hussain other posts by this author
Apr 17 2006 10:56AM messages near this date
Re: [Image-SIG] Compiling PIL on the MacBook Pro | Re: [Image-SIG] PSDraw in PIL problem with print
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 
_______________________________________________
Image-SIG maillist  -  Image-SIG@[...].org
http://mail.python.org/mailman/listinfo/image-sig
Thread:
Sajjad Hussain
Fredrik Lundh

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved