Generating cropped PNG files from Praat EPS

When converting a praat eps file to png (e.g. for web publishing) with gs, the whole Picture window display is included in the png file, rendering lots of extra white space. One solution is to crop the image using the Netpbm package.

Example:

  1. gs -sDEVICE=ppmraw -dTextAlphaBits=4 -r120 -sOutputFile=- -sNOPAUSE -q praat.eps -c showpage -c quit | pnmcrop | pnmmargin -white 10 | pnmtopng > praat.png

Or just use the EPSCrop option:

  1. gs -sDEVICE=png16m -dTextAlphaBits=4 -dEPSCrop -r120 -dSAFER -dBATCH -dNOPAUSE -sOutputFile=$soundDir/$pngFile2 -q $soundDir/$epsFile

See a demo here: mbrola.php