LinuxCommandLibrary

pnmtops

Convert PNM image format to PostScript

TLDR

Convert a PNM image to a PS file

$ pnmtops [path/to/file.pnm] > [path/to/file.ps]
copy

Specify the dimensions of the output image in inches
$ pnmtops [[-imagew|-imagewidth]] [imagewidth] [[-imageh|-imageheight]] [imageheight] [path/to/file.pnm] > [path/to/file.ps]
copy

Specify the dimensions of the page the output image resides on in inches
$ pnmtops [[-w|-width]] [width] [[-h|-height]] [height] [path/to/file.pnm] > [path/to/file.ps]
copy

SYNOPSIS

pnmtops [-width=width] [-height=height]

PARAMETERS

-width=width
    Specify the desired width of the topscan image in pixels. If not specified, the width of the input PNM is used.

-height=height
    Specify the desired height of the topscan image in pixels. If not specified, the height of the input PNM is used.

DESCRIPTION

The pnmtops command converts a portable anymap (PNM) image into a topscan format. Tops can files are used in older scanners. PNM is a simple image format that represents raster images using ASCII or binary encoding and supports black and white (PBM), grayscale (PGM), and color (PPM) images. The command reads a PNM image from standard input and writes the corresponding topscan data to standard output. The input file must be a PBM, PGM, or PPM image, because topscan is a type of grayscale image.
The topscan format describes the image one scanline at a time in row order, where pixel values represent grayscale intensity values.
Using pnmtops, one can process images created with modern tools to be compatible with those legacy systems, enabling processing, archival, or other operations. It's a niche tool, but valuable for those who need to work with this format.

NOTES

If the width or height parameters are provided, but the aspect ratio of the input PNM doesn't match it, the image will be resized to those new dimensions. Consider piping the PNM to pnmscale before using pnmtops in order to create the desired height to width ratio.

SEE ALSO

ppmtopgm(1), pnm(5), ppm(5)

Copied to clipboard