Gxyat

From OpenGrads Wiki
Jump to: navigation, search

NAME

GxYat - Yet Another GrADS Metafile Translator

SYNOPSIS

    gxyat [OPTIONS]  output_image_file          (built-in GrADS command)
    gxyat [OPTIONS]  input_metafile_name[.gm]   (stand alone utility)

DESCRIPTION

GxYat is a GrADS metafile translator based on the Cairo Vector Graphics library. It can be implemented as a stand alone command line utility or as a built-in GrADS command through User Defined eXtensions (UDXs).

GxYat is capable of producing PNG, Postscript, PDF and Scalable Vector Graphics (SVG) output. When producing PNG images, the translator uses antialiasing for rendering line drawing but not for polygon fills, resulting in nicer fonts, but no artificial horizontal lines in the shaded contours.

When used as built-in GrADS command, one specifies the output image file name on the command line, pretty much like printim. However, image size and other option syntax depart slightly from printim; see OPTIONS below for details.

When used as stand alone utility, the input file extension is assumed to be '.gm', if omitted. One can use '-' to indicate that the metafile is coming from standard input.

The input metafile may contain more than one frame; multipage PS and PDF output will result in such cases. However, PNG and SVG output require one image per file. By using %d or other printf variant format such as %02d in the output file name it is possible to have the resulting files numbered in sequence. See EXAMPLES below.

The output format is determined from the output file name extension; the default is PNG.

The GxYat output can be displayed by a variety of viewers. On Linux, I particularly like evince, a document viewer that is capable of displaying all the formats produced by GxYat: be sure to check out its presentation mode. Firefox 2 has native support for PNG and SVG; Acrobad Reader, as well as Ghostscript and frontends can read the PS/ PDF output. The ImageMagick utilities can handle all GxYat output formats except for SVG which it does not render properly. On Linux, the Inkscape SVG Vector Illustrator is a nice SVG editor for annotating GrADS plots (since it is SVG, the output is scalable). Adobe Illustrator also has native suppoprt for SVG.

OPTIONS

    +a           turns anti-aliasing OFF (default is ON)
    -h           prints this manual page
    -i fname     input file name; '-' means standard input;   
    -o fname     output file name; the file name extension determines
                 the desired format:
                    png     Portable Network Graphics        
                    ps      Postscript
                    pdf     Portable Document Format (PDF)
                    svg     Scalable Vector Graphics
                 Both PS and PDF allow multiple pages per file; PNG and
                 SVG require one image per file; in such cases, specify %d
                 in the file name for the image number in the sequence 
                 - see EXAMPLES below.
                 Default:  same base name as input file, 'png' extension
    -r           Black background (default is white)
    -v           Verbose.
    -x m         For images, the number of horizontal pixels (default=800);
                 For PS/PDF output, the horizontal size of the images 
                 in points (1 point = 1/72 inches); default is 792 points
                 (11 inches)
    -y n         For images, the number of vertical pixels (default=600);
                 For PS/PDF output, the horizontal size of the images 
                 in points (1 point = 1/72 inches); default is 612 points
                 (8.5 inches)
    -w s         Specify line width scaling; default is 1.0. Use this
                 if you think the lines are too thick or too faint

EXAMPLES

  • Producing a PNG image file with the default 800x600 size:
       $ gxyat model.gx
  • Producing a PDF file with the default 792x612 size (11x8.5 inches):
       $ gxyat -o model.pdf model.gx
  • Producing a PNG image file of size 1024x758 with a black background:
       $ gxyat -x 1024 -y 758 -r model.gx 
  • Producing a SVG file to be rendered with size 1600x1200:
       $ gxyat -o model.svg -x 1600 -y 1200 model.gx
  • Producing multiple image files from a metafile with multiple frames:
       $ gxyat -o frame-%d.png frames.gx
       $ gxyat -o frame-%02d.svg frames.gx
  • The following DOES NOT work:
       $ gxyat -o frame-%d.ps  frames.gx
       $ gxyat -o frame-%d.pdf frames.gx

BUGS

  • Only PNG images do not have artificial horizontal lines in shaded contours; the other formats still do, at least when rendered to the screen with antialising on. This is a feature of the Cairo Vector Graphics Library and/or the particular viewers. Since the SVG standard makes provision for selective antialiasing during rendering, it is possible that Cairo will support this feature at some point.
  • The PS output still needs some tuning; the bounding box seem to be correct, though.

TO DO

  • Allow for compressed SVG and PS output through zlib.
  • Allow for output to STDOUT and/or to pipes.
  • Allow for images to be rendered directly on the screen.

VERSION

GxYat Version 1.2.0 built with Cairo Version 1.4.8

AUTHOR

Arlindo da Silva <dasilva@alum.mit.edu> based on gxpng by Matthias Muennich.

COPYRIGHT

Copyright (c) 2007 Arlindo da Silva

This is free software released under the GNU General Public License; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

SEE ALSO