#!/bin/csh -f # Usage: ps_no_bleedthrough ps_file # # Ferret PostScript files that contain shaded or filled regions # often yield poor results upon conversion to PNG, GIF, etc. with # antialiasing, since the edges of interior rectangles are blended # with the background color. This produces "stripes" or a "grid" # of the background color "bleeding through" the shaded areas. # This script reduces this effect, by slightly altering the PostScript. # Result goes to standard output. # # Authors: Andrew Wittenberg, Rong Zhang # Version dated 21 January 2011 # get list of all arguments set args = ($*) # if not enough arguments, complain. if ($#args < 1) then echo "Usage: ps_no_bleedthrough ps_file" echo "Reduces bleed-through of PostScript background color when converting" echo "to an antialiased rasterized image (PNG, GIF, etc.)." echo "Result goes to standard output." echo "Example: ps_no_bleedthrough myfile.ps > myfile_new.ps" exit 1 endif sed -e 's,^/cp {closepath} def$,/cp {closepath gsave fill grestore stroke} def,' \ -e '/\/rect {/,/} def/ s,^ cp$,% cp,' $1