working png output from graphing modules

Are there any charting or graphing modules for python that can write
PNG, JPEG, or GIF graphics? I have found a couple of nice looking
packages that can make beautiful postscript, PDF, or SVGs (PyChart and
ReportLab) but they can't make PNGs, GIFs, or JPEGs. (On my Solaris
machine with Python 2.2 they don't.) Or are there any simple UNIX
filters to convert SVG, PDF, or ps files to PNG?

Advertisements

In article <>, john
<> writes
>Are there any charting or graphing modules for python that can write
>PNG, JPEG, or GIF graphics? I have found a couple of nice looking
>packages that can make beautiful postscript, PDF, or SVGs (PyChart and
>ReportLab) but they can't make PNGs, GIFs, or JPEGs. (On my Solaris
>machine with Python 2.2 they don't.) Or are there any simple UNIX
>filters to convert SVG, PDF, or ps files to PNG?
ReportLab certainly makes png/gif/jpeg, but only if you build the
_renderPM extension and also PIL. I know that's possible with solaris 8
as I have done it myself, but haven't done much with later versions.
There's also a requirement to get appropriate T1 font files.
--
Robin Becker

Advertisements

(john) writes:
> Are there any charting or graphing modules for python that can write
> PNG, JPEG, or GIF graphics? I have found a couple of nice looking
> packages that can make beautiful postscript, PDF, or SVGs (PyChart and
> ReportLab) but they can't make PNGs, GIFs, or JPEGs. (On my Solaris
> machine with Python 2.2 they don't.) Or are there any simple UNIX
> filters to convert SVG, PDF, or ps files to PNG?

The 'convert' utility from ImageMagick (google for it) is very good at
converting PDF or PS to PNG. It uses ghostscript to do the actual
conversion; it's just very good at choosing the right options to pass
to ghostscript.

convert -geometry 800x600 -density 200 foo.ps foo.png

Will convert a postscript to a png, keeping the aspect ratio correct
but making it fit inside an 800 by 600 pixel area. The -density
argument tells it the dpi to use when rendering the image. Higher
values are slower but give better results.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!