pipes and commands

Tim Evans tre17 at student.canterbury.ac.nz
Sat Oct 30 19:49:35 EDT 1999


Gregor Zych <zych at pool.informatik.rwth-aachen.de> writes:

> "Tim Evans" <tre17 at student.canterbury.ac.nz> writes:
> 
> > Gregor Zych <zych at pool.informatik.rwth-aachen.de> writes:
> > 
> > > Hi!
> > > How can I get many commands connected with pipes executed. I try
> > > 
> > > startexe = 'gs -q -dNOPAUSE -sDEVICE=pbmraw -r600x600 -sOutputFile=- '+pfad+'/'+name+'.eps quit.ps | pnmcut 610 982 4023 5483 | pnmtotiff - > '+pfad+'/'+name+'.tif'
> > > os.system(startexe)
> > > 
> > > but the system just waits for ever until I interrupt it, although it
> > > gets the final file written correctly.
> > > os.popen() seems to make my system unusable 'cos it slurps the generated 
> > > file und these pictures are HUGE. Any hints are welcome.
> > > Linux 2.2.11 python 1.5.2
> > > Ciao
> > > 	Gregor
> > 
> > Not a Python solution, but the `convert' program from `imagemagick' is
> > really good at this sort of conversion (ps -> image) and can do all of
> > the above line in a single step IIRC, so you don't need the pipes.
> Tell me where I can change the resolution and I'll do it. 
> 

Not sure if this is the right option, but here's an extract from the
convert man page:

       -density <width>x<height>
              vertical and horizontal resolution in pixels of the
              image.

              This  option specifies an image density when decod­
              ing a Postscript or Portable  Document  page.   The
              default is 72 pixels per inch in the horizontal and
              vertical direction.  This option is used in concert
              with -page.

I have found from my own experience that the -density option must be
placed *before* the postscript file.  For example:

convert -density 1000x1000 bar.ps -geometry 500x500 png:bar.png

--
Tim Evans




More information about the Python-list mailing list