---
name: "grap2graph"
section: "1"
platform: "linux"
package: "groff"
version: "1.24.2-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/grap2graph"
---

# grap2graph(1)

convert a grap diagram into a cropped image

## Name

grap2graph - convert a *grap* diagram into a cropped image

## Synopsis

**grap2graph** \[**-unsafe**\] \[**-format**  *output-format*\] \[*convert-argument* ...\]

**grap2graph** **--help**

**grap2graph** **-v**

**grap2graph** **--version**

## Description

*grap2graph* reads a [*grap*(1)](/grap/1.md) program from the standard input and writes an image file, by default in Portable Network Graphics (PNG) format, to the standard output.

The input GRAP code should *not* be wrapped with the **.G1** and **.G2** macros that normally guard it within [*groff*(1)](/groff/1.md) documents.

Arguments not recognized by *grap2graph* are passed to the ImageMagick or GraphicsMagick program [*convert*(1)](/convert/1.md). By specifying these, you can give your image a border, set the image's pixel density, or perform other useful transformations.

The output image is clipped using *convert*'s **-trim** option to the smallest possible bounding box that contains all the black pixels.

## Options

**--help** displays a usage message, while **-v** and **--version** show version information; all exit afterward.

- **-format** *output-format*

  Write the image in *output-format*, which must be understood by *convert*; the default is PNG.

- **-unsafe**

  Run *groff* in *unsafe* mode, enabling the PIC command **sh** to execute arbitrary Unix shell commands. The *groff* default is to forbid this.

## Environment

- *GROFF\_TMPDIR* *TMPDIR* *TMP* *TEMP*

  These environment variables are searched in the order shown to determine the directory where temporary files will be created. If none are set, */tmp* is used.

## Authors

*grap2graph* was written by Eric S. Raymond ⟨esr@\\:thyrsus\\:.com⟩, based on a recipe for [*pic2graph*(1)](/pic2graph/1.md), by W. Richard Stevens.

## See also

[*pic2graph*(1)](/pic2graph/1.md), [*eqn2graph*(1)](/eqn2graph/1.md), [*grap*(1)](/grap/1.md), [*pic*(1)](/pic/1.md), [*groff*(1)](/groff/1.md), [*convert*(1)](/convert/1.md)
