1PS2RASTER(1)                 Generic Mapping Tools                PS2RASTER(1)
2
3
4

NAME

6       ps2raster - Converts one or several PostScript file(s) to other formats
7       using GhostScript
8

SYNOPSIS

10       ps2raster psfile(s) [ -A[u|-] ] [ -Cgs_option ] [ -Doutdir ] [  -Ereso‐
11       lution ] [ -Gghost_path ] [ -Llistfile ] [ -P ] [ -Q[g|t][1|2|4] ] [ -S
12       ] [ -Tb|e|f|j|g|G|m|t ] [ -V ] [  -W[+g][+tdocname][+nlayername][+aalt‐
13       mode[alt]][+lminLOD/maxLOD][+fminfade/maxfade][+uURL] ]
14

DESCRIPTION

16       ps2raster  converts one or more PostScript files to other formats (BMP,
17       EPS, JPEG, PDF, PNG, PPM, TIFF) using GhostScript. Input file names are
18       read from the command line or from a file that lists them.  The size of
19       the resulting images is determined by the BoundingBox  (or  HiResBound‐
20       ingBox,  if  present).  As an option, a tight (HiRes)BoundingBox may be
21       computed first. As another option, it can compute ESRI type world files
22       used  to reference, for instance, tif files and make them be recognized
23       as geotiff.
24
25       psfiles
26              Names of PostScript files to be converted. The output files will
27              have the same name (unless -F is used) but with the conventional
28              extension name associated to the raster format  (e.g.  .jpg  for
29              the  jpeg format).  Use -D to redirect the output to a different
30              directory.
31

OPTIONS

33       -A     Adjust the  BoundingBox  and  HiResBoundingBox  to  the  minimum
34              required  by  the  image  content.  Append u to first remove any
35              GMT-produced time-stamps.  Use -A-  to  override  any  automatic
36              setting of -A by -W.
37
38       -C     Specify a single, custom option that will be passed on to Ghost‐
39              Script as is.  Repeat to add several options [none].
40
41       -D     Sets an alternative output directory (which must exist) [Default
42              is  the  same  directory as the PS files].  Use -D. to place the
43              output in the current directory instead.
44
45       -E     Set raster resolution in dpi [default = 720  for  PDF,  300  for
46              others].
47
48       -F     Force  the  output  file  name. By default output names are con‐
49              structed using the input names as base, which are appended  with
50              an appropriate extension. Use this option to provide a different
51              name, but without extension. Extension is still determined auto‐
52              matically.
53
54       -G     Full  path  to your GhostScript executable.  NOTE: For Unix sys‐
55              tems this is generally not necessary.  However,  under  Windows,
56              GhostScript  is not added to the system's path. So either you do
57              it yourself, or  give  the  full  path  here.  (e.g.,  -Gc:\pro‐
58              grams\gs\gs7.05\bin\gswin32c).
59
60       -L     The  listfile  is an ASCII file with the names of the PostScript
61              files to be converted.
62
63       -N     This option is obsolete.  Use -S to print the  GhostScript  com‐
64              mand, if applicable.  Use -Te to save the intermediate EPS file.
65
66       -P     Force  Portrait  mode.  All Landscape mode plots will be rotated
67              back so that they show unrotated in Portrait mode. This is prac‐
68              tical  when  converting to image formats or preparing EPS or PDF
69              plots for inclusion in documents.
70
71       -Q     Set the anti-aliasing options for graphics or text.  Append  the
72              size of the subsample box (1, 2, or 4) [4].  Default is no anti-
73              aliasing (same as bits = 1).
74
75       -S     Print to standard output the GhostScript command  after  it  has
76              been executed.
77
78       -T     Sets  the output format, where b means BMP, e means EPS, f means
79              PDF, j  means  JPEG,  g  means  PNG,  G  means  transparent  PNG
80              (untouched  regions  are  transparent), m means PPM, and t means
81              TIFF [default is JPEG].  For bjgt you can  append  -  to  get  a
82              grayscale  image  only.  The EPS format can be combined with any
83              of the other formats. For example, -Tef creates both an EPS  and
84              a PDF file.
85
86       -V     Selects verbose mode, which will send progress reports to stderr
87              [Default runs "silently"].
88
89       -W     Write a ESRI type world file suitable to make (e.g)  .tif  files
90              be recognized as geotiff by softwares that know how to do it. Be
91              aware, however, that different results are obtained depending on
92              the  image  contents  and if the -B option has been used or not.
93              The trouble with the -B option is that it creates  a  frame  and
94              very likely its annotations.  That introduces pixels outside the
95              map data extent, and therefore the map extents  estimation  will
96              be  wrong.   To  avoid  this  problem  use --BASEMAP_TYPE=inside
97              option which plots all annotations and ticks  inside  the  image
98              and  therefore  does not compromise the coordinate computations.
99              Pay attention also to the cases when the plot  has  any  of  the
100              sides with whites only because than the algorithm will fail mis‐
101              erably as those whites will be eaten by the GhostScript. In that
102              case you really must use -B or use a slightly off-white color.
103              Together   with  -V  it  prints  on  screen  the  gdal_translate
104              (gdal_translate is a command line tool from  the  GDAL  package)
105              command  that  reads  the raster + world file and creates a true
106              geotiff file. Use -W+g to do a system call to gdal_translate and
107              create  a  geoTIFF image right away. The output file will have a
108              .tiff extension.
109              The world file naming follows the convention of jamming a 'w' in
110              the file extension. So, if output is tif -Tt the world file is a
111              .tfw, for jpeg we have a .jgw and so on.  This option  automati‐
112              cally sets -A -P.
113              Use -W+k to create a minimalist KML file that allows loading the
114              image in GoogleEarth. Note that for this option the  image  must
115              be  in geographical coordinates. If not, a warning is issued but
116              the KML file is created anyway.  Several  modifier  options  are
117              available to customize the KML file in the form of +opt strings.
118              Append +ttitle to set the document  title  [GMT  KML  Document],
119              +nlayername  to  set the layer name, and +a/altmode[altitude] to
120              select one of 5 altitude modes recognized by Google  Earth  that
121              determines  the  altitude  (in m) of the image: G clamped to the
122              ground, g append altitude relative to ground, a append  absolute
123              altitude, s append altitude relative to seafloor, and S clamp it
124              to the seafloor.  Control  visibility  of  the  layer  with  the
125              +lminLOD/maxLOD  and +fminfade/maxfade options.  FInally, if you
126              plan to leave the image itself on a server and  only  distribute
127              the  KML,  use  +uURL to prepend the URL to the image reference.
128              See   the   KML   documentation    for    further    explanation
129              (http://code.google.com/apis/kml/documentation/).
130              Further   notes   on  the  creation  of  georeferenced  rasters.
131              ps2raster can create a georeferenced raster image with  a  world
132              file OR uses GDAL to convert the GMT PostScript file to geotiff.
133              GDAL uses Proj.4 for it's projection library.  To  provide  with
134              the  information  it  needs  to  do  the georeferencing, GMT 4.5
135              embeds a comment near the start of the PostScript file  defining
136              the  projection  using  Proj.4  syntax.  Users with pre-GMT v4.5
137              PostScript files, or even non-GMT  ps  files,  can  provide  the
138              information  ps2raster  requires by manually editing a line into
139              the PostScript file, prefixed with %%PROJ.
140              For example the command pscoast -JM0/12c -R-10/-4/37/43 -W1  -Di
141              -Bg30m --BASEMAP_TYPE=inside > cara.ps
142              adds this comment line
143              %%PROJ:  merc  -10.0  -4.0  37.0  43.0  -1113194.908 -445277.963
144              4413389.889 5282821.824 +proj=merc +lon_0=0 +k=-1 +x_0=0  +y_0=0
145              +a=6378137.0 +b=6356752.314245
146              where 'merc' is the keyword for the coordinate conversion; the 2
147              to 5th elements contain the map limits, 6 to 9th the map  limits
148              in  projected coordinates and the rest of the line has the regu‐
149              lar proj4 string for this projection.
150

NOTES

152       The conversion to raster images (BMP, JPEG, PNG, PPM  or  TIFF)  inher‐
153       ently  results  in  loss  of details that are available in the original
154       PostScript file. Choose a resolution  that  is  large  enough  for  the
155       application that the image will be used for. For web pages, smaller dpi
156       values suffice, for  Word  documents  and  PowerPoint  presentations  a
157       higher  dpi  value  is  recommended. ps2raster uses the loss-less Flate
158       compression technique when creating JPEG, PNG and TIFF images.
159
160       EPS is a vector, not a raster format. Therefore, the -E option  has  no
161       effect  on  the creation of EPS files. Using the option -Te will remove
162       PageSize commands from the PostScript file and will adjust  the  Bound‐
163       ingBox  when  the  -A  option  is used.  Note the original and required
164       BoundingBox is  limited  to  integer  points,  hence  Adobe  added  the
165       optional  HiResBoundingBox  to  add  more  precision in sizing.  The -A
166       option calculates both and writes both to the EPS file used in the ras‐
167       terization (and output if -Te is set).
168
169       Although  PDF  is  also a vector format, the -E option has an effect on
170       the resolution of pattern fills and fonts that are stored as bitmaps in
171       the document. ps2raster therefore uses a larger default resolution when
172       creating PDF files. In order to  obtain  high-quality  PDF  files,  the
173       /prepress options are in effect, allowing only loss-less Flate compres‐
174       sion of raster images embedded in the PostScript file.
175
176       Although ps2raster was developed as part of the GMT, it can be used  to
177       convert  PostScript  files created by nearly any graphics program. How‐
178       ever, -Au is GMT-specific.
179
180       See Appendix C of the GMT Technical Reference  and  Cookbook  for  more
181       information  on  how  ps2raster is used to produce graphics that can be
182       inserted into other documents (articles, presentations, posters, etc.).
183

EXAMPLES

185       To convert the file psfile.ps to PNG  using  a  tight  BoundingBox  and
186       rotating  it  back  to  normal  orientation in case it was in Landscape
187       mode:
188
189       ps2raster psfile.ps -A -P -Tg
190
191       To create a simple linear map with pscoast and convert it to tif with a
192       .tfw the tight BoundingBox computation.
193
194       pscoast    -JX12cd    -R-10/-4/37/43    -W1   -Di   -Bg30m   -P   -G200
195       --BASEMAP_TYPE=inside > cara.ps
196
197       ps2raster cara -Tt -W
198
199       To create a Mercator version of the above example and use GDAL to  pro‐
200       duce a true geotiff file.
201
202       pscoast    -JM0/12c    -R-10/-4/37/43   -W1   -Di   -Bg30m   -P   -G200
203       --BASEMAP_TYPE=inside > cara.ps
204
205       gdalwarp -s_srs +proj=merc cara.tif carageo.tiff
206
207       To create a Polar Stereographic geotiff file of Patagonia
208
209       pscoast  -JS-55/-60/15c  -R-77/-55/-57.5/-48r   -Di   -Gred   -P   -Bg2
210       --BASEMAP_TYPE=inside > patagonia.ps
211
212       ps2raster patagonia.ps -Tt -W+g -V
213
214       To create a simple KMZ file for use in Google Earth, try
215
216       grdimage lonlatgrid.nc -Jx1 -Ccolors.cpt -P -B0g2 --BASEMAP_TYPE=inside
217       > tile.ps
218
219       ps2raster tile.ps -Tg -W+k+t"my title"+l256/-1 -V
220
221       (These commands assume that GhostScript can be found in  your  system's
222       path.)
223

BINARY DATA

225       GMT  programs  can  produce  binary  PostScript  image data and this is
226       determined by the default setting PS_IMAGE_FORMAT.   Because  ps2raster
227       needs  to  process  the input files on a line-by-line basis you need to
228       make sure the image format is set to ascii and not bin.
229

GHOSTSCRIPT OPTIONS

231       Most of the conversions done in ps2raster are handled  by  GhostScript.
232       On  most Unixes this program is available as gs; for Windows there is a
233       version called gswin32c.  GhostScript accepts a rich selection of  com‐
234       mand-line  options  that  modify  its  behavior.  Many of these are set
235       indirectly by the options available above.   However,  hard-core  usage
236       may  require  some  users  to  add  additional options to fine-tune the
237       result.  Use -S to examine the actual  command  used,  and  add  custom
238       options  via  one or more instances of the -C option.  For instance, to
239       turn on image interpolation for all images, improving image quality for
240       scaled  images  at  the  expense  of speed, use -C-dDOINTERPOLATE.  See
241       www.ghostscript.com for complete documentation.
242

SEE ALSO

244       GMT(1), gs(1)
245
246
247
248GMT 4.5.6                         10 Mar 2011                     PS2RASTER(1)
Impressum