[Thread Prev][Thread Next][Index]
[ferret_users] reducing background bleedthrough (white lines/grid) in Ferret PostScript
Dear Ferreters,
One question has come up often on the Ferret Users' Group: how does one
prevent the spurious "stripes," "lines," or "grid" that show up in SHADE
or FILL plots, which have been output to PostScript? These have been
mentioned in several threads:
http://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2008/msg00066.html
http://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2009/msg00613.html
http://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2010/msg00632.html
The lines appear when converting a Ferret-generated PostScript file to a
rasterized image, like PNG or GIF, with antialiasing turned on. They also
appear in PostScript viewers like "ghostview", which rasterize the
PostScript image for display and often have antialiasing turned on by
default.
My understanding is that the rasterizer attempts to blend together the
edges of the many little colored rectangles that make up the shaded area
of the plot; but somehow these are blended with the background color
(usually white), instead of their neighboring rectangle -- hence thin
white lines show up all over the plot. One solution is to turn off the
antialiasing; but that's not always preferred, since it can give
blocky-looking results.
My colleague Rong Zhang suggested a solution, which involves editing the
Ferret-generated PostScript slightly. The edits help fill the gaps
between the little shaded rectangles, so that the antialiasing blends
neighboring rectangles together with less influence from the background
color. This makes the line artifacts nearly invisible.
I've wrapped these edits in a very short C-shell script, which uses "sed"
to do the work:
http://www.gfdl.noaa.gov/~atw/ferret/ps_no_bleedthrough
To fix a Ferret PostScript file so that the background won't "bleed
through" as much when doing antialiased rasterization, do
ps_no_bleedthrough in.ps > out.ps
(A request to the Ferret developers: in a future Ferret release, would it
be possible to get these changes into the PostScript commands generated by
Ferret, to make the above script unnecessary?)
Cheers,
Andrew
On Fri, 21 Jan 2011, Rong Zhang wrote:
Here are the changes in the ps file to remove the lines:
1, use the following command at Line 69:
/cp {closepath gsave fill grestore stroke} def
to replace the original one:
/cp {closepath} def
2, comment out cp in /rect {}, around Line 79, i.e.
/rect {
np
3 -1 roll exch mv
currentpoint 4 -1 roll exch ln
currentpoint pop 3 -1 roll ln
currentpoint exch pop ln
% cp
} def
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
Ferret
Privacy Policy | Disclaimer | Accessibility Statement