From: Wayne W. <sie...@sb...> - 2010-01-19 15:21:32
|
Thanks. I'll keep this in mind when I get to the point when I'm ready to consider it as part of a program I'm writing. Someone in Image-SIG sent me a module he wrote that might be helpful too. Michael Droettboom wrote: > Wayne Watson wrote: >> I've used MPL a bit, and am wondering if there's a facility 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? >> > You can use one of the non-GUI backends to generate plots in a number > of formats, including PNG, PDF, PS and SVG. See this: > > http://matplotlib.sourceforge.net/faq/installing_faq.html#backends > > The PDF backend is the only one I'm aware of that supports multiple > pages. This is the docstring for PdfPages: > > A multi-page PDF file. > > Use like this:: > > # Initialize: > pp = PdfPages('foo.pdf') > > # As many times as you like, create a figure fig, then either: > fig.savefig(pp, format='pdf') # note the format argument! > # or: > pp.savefig(fig) > > # Once you are done, remember to close the object: > pp.close() > > (In reality PdfPages is a thin wrapper around PdfFile, in order to > avoid confusion when using savefig and forgetting the format > argument.) > >> Is there any image processing operation available to do simple >> operations like dark subtract or stack different images on one other >> to produce composites of several images? Maybe Python has such a >> facility that's already available as a library? >> >> > Matplotlib doesn't have a very strong set of these things built-in > (though some things are possible with the image support in the image > module). You can also get an rgb buffer of the figure (when using the > Agg backend), eg. (where 'fig' is the figure object): > > fig.canvas.get_renderer().tostring_rgb() > > This is a string of 24-bit rgb triples, which can be converted to the > Numpy array for arithmetical processing, or converted to a Python > Imaging Library Image object. > > Mike > -- 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/> |