[Image-SIG] Printing Matplotlib (MPL) Graphs in PIL?

Kevin Cazabon kevin at cazabon.com
Mon Jan 18 02:53:40 CET 2010


Here's a module that will print any PIL image for you... it's been a long time since I've modified it or tested it, but it should work on Windows systems at least.  It was based on some code from someone else (I think I referenced them in the code), but cleaned up and expanded.  There's some sample usages at the bottom I believe too.

ImagePrintWin.py is what you want... I've included some random test files too.  Good luck!


It also includes a Tkinter class for a "Print" dialog, including print preview.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ImagePrintWin.py
Type: text/x-python-script
Size: 102854 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20100117/2ac27cbc/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: printdemo.py
Type: text/x-python-script
Size: 7556 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20100117/2ac27cbc/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PrinterTesting.py
Type: text/x-python-script
Size: 1599 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20100117/2ac27cbc/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: printTest.py
Type: text/x-python-script
Size: 1115 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20100117/2ac27cbc/attachment-0007.bin>
-------------- next part --------------



(I'll gladly append more open licensing if anyone wants it, or if Fred is willing to add yet another hack of mine to the standard Library... sorry this one isn't so clean)

Kevin.


On 17 Jan 2010, at 11:16, Wayne Watson wrote:

> I've used MPL a bit, and am wondering if there's a facility in PIL for sending graphic images to a printer, or putting them in some format like png? I don't necessarily want the graphics to appear in a window, but would like to print them directly once they are ready. Can one put in a page feed, so that images don't all fall on the same page or cut across pages?
> 
> I asked about this in the MPL list and didn't get a single reply, so I guess there's nothing in MPL that will do it.
> 
> 
> -- 
>           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
> 
>             (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
>              Obz Site:  39? 15' 7" N, 121? 2' 32" W, 2700 feet
> 
>           "I was thinking about how people seem to read the Bible
>            a whole lot more as they get older; then it dawned on
>            me . . they're cramming for their final exam."
>                                    -- George Carlin
> 
>                    Web Page: <www.speckledwithstars.net/>
> 
> 
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig



More information about the Image-SIG mailing list