pygmt.Figure.psconvert

Figure.psconvert(*, crop=None, gs_option=None, dpi=None, prefix=None, icc_gray=None, fmt=None, anti_aliasing=None, verbose=None, **kwargs)[source]

Convert [E]PS file(s) to other formats.

Converts one or more PostScript files to other formats (BMP, EPS, JPEG, PDF, PNG, PPM, SVG, TIFF) using GhostScript.

If no input files are given, will convert the current active figure (see pygmt.figure). In this case, an output name must be given using parameter prefix.

Full option list at https://docs.generic-mapping-tools.org/latest/psconvert.html

Aliases:

  • A = crop

  • C = gs_option

  • E = dpi

  • F = prefix

  • I = icc_gray

  • Q = anti_aliasing

  • T = fmt

  • V = verbose

Parameters
  • crop (str or bool) – Adjust the BoundingBox and HiResBoundingBox to the minimum required by the image content. Append u to first remove any GMT-produced time-stamps. Default is True.

  • gs_option (str) – Specify a single, custom option that will be passed on to GhostScript as is.

  • dpi (int) – Set raster resolution in dpi. Default = 720 for PDF, 300 for others.

  • prefix (str) – Force the output file name. By default output names are constructed using the input names as base, which are appended with an appropriate extension. Use this option to provide a different name, but without extension. Extension is still determined automatically.

  • icc_gray (bool) – Enforce gray-shades by using ICC profiles.

  • anti_aliasing (str) – [g|p|t][1|2|4]. Set the anti-aliasing options for graphics or text. Append the size of the subsample box (1, 2, or 4) [4]. [Default is no anti-aliasing (same as bits = 1)].

  • fmt (str) – Sets the output format, where b means BMP, e means EPS, E means EPS with PageSize command, f means PDF, F means multi-page PDF, j means JPEG, g means PNG, G means transparent PNG (untouched regions are transparent), m means PPM, s means SVG, and t means TIFF [default is JPEG]. To b|j|g|t, optionally append +m in order to get a monochrome (grayscale) image. The EPS format can be combined with any of the other formats. For example, ef creates both an EPS and a PDF file. Using F creates a multi-page PDF file from the list of input PS or PDF files. It requires the prefix parameter.

  • verbose (bool or str) –

    Select verbosity level [Default is w], which modulates the messages written to stderr. Choose among 7 levels of verbosity:

    • q - Quiet, not even fatal error messages are produced

    • e - Error messages only

    • w - Warnings [Default]

    • t - Timings (report runtimes for time-intensive algorithms);

    • i - Informational messages (same as verbose=True)

    • c - Compatibility warnings

    • d - Debugging messages