LinuxCommandLibrary

pnmenlarge

Enlarge a PNM image

TLDR

View documentation for the current command

$ tldr pamenlarge
copy

SYNOPSIS

pnmenlarge [-x bits] [-y bits] [pnmfile]

PARAMETERS

-x bits
    Specifies the horizontal enlargement factor as 2bits. Each pixel is replicated horizontally 2bits times. The default value for 'bits' is 1, resulting in a 2x horizontal enlargement.

-y bits
    Specifies the vertical enlargement factor as 2bits. Each pixel is replicated vertically 2bits times. The default value for 'bits' is 1, resulting in a 2x vertical enlargement.

pnmfile
    Path to the input portable anymap (PBM, PGM, or PPM) file. If this argument is omitted, pnmenlarge reads the image data from standard input.

DESCRIPTION

pnmenlarge is a command-line utility from the Netpbm suite designed to enlarge portable anymap (PBM, PGM, PPM) images. It achieves enlargement by a simple method of pixel replication: each pixel in the original image is duplicated a specified number of times, both horizontally and vertically, to create a larger block of identical pixels in the output.

The enlargement factor is determined by powers of two; specifically, 2bits for both horizontal and vertical dimensions. For instance, if 'bits' is 1, each pixel becomes a 2x2 block, effectively doubling the image's dimensions. By default, pnmenlarge enlarges images by a factor of 2 (i.e., bits=1) in both directions. While functional for basic integer scaling, this method of enlargement can result in a 'blocky' or 'pixelated' appearance, especially when scaling up significantly. This tool reads input from a specified file or standard input and always outputs a Portable Graymap (PGM) file, converting color or monochrome inputs to grayscale. Due to its limitations and the availability of more sophisticated scaling algorithms, pnmenlarge is considered obsolete, with pamscale(1) being the recommended alternative for most image scaling tasks.

CAVEATS

This command is considered obsolete. Users are advised to use pamscale(1) for image scaling, which offers more flexibility and better algorithms. pnmenlarge performs simple pixel replication, which can result in a blocky and unsmooth appearance, particularly for large scaling factors. The output is always a Portable Graymap (PGM) file, regardless of the input type (PBM, PGM, or PPM).

INPUT/OUTPUT

pnmenlarge reads the input image from standard input if no pnmfile is specified. The enlarged image is then written to standard output.

OUTPUT FORMAT

The output of pnmenlarge is exclusively a Portable Graymap (PGM) file. If the input was a PBM (monochrome) file, the output PGM will represent black as 0 and white as 255. If the input was a PPM (color) file, it will be converted to grayscale before enlargement.

HISTORY

Part of the Netpbm suite, pnmenlarge is one of the older utilities designed for basic image manipulation. Its functionality for simple integer scaling has largely been superseded by more advanced and general-purpose tools like pamscale(1), leading to its current classification as obsolete within the Netpbm project.

SEE ALSO

pamscale(1), pnmreduce(1), pnm(5)

Copied to clipboard