pbmpscale
Scale Portable Bitmap images
TLDR
Enlarge a PBM image by the specified factor with edge smoothing
SYNOPSIS
pbmpscale [ -x factor ] [ -y factor ] [ file ]
PARAMETERS
-x factor
Scales the image horizontally by the specified integer factor.
-y factor
Scales the image vertically by the specified integer factor.
file
The input PBM image file. If omitted, pbmpscale reads from standard input.
DESCRIPTION
pbmpscale is a Netpbm command-line utility for scaling Portable BitMap (PBM) images. It reads a PBM image from standard input (or a specified file) and writes the scaled image to standard output. Crucially, pbmpscale can only scale by integer factors, making it suitable for simple enlargements where each pixel is replicated. For example, scaling by a factor of 3 means each pixel becomes a 3x3 block of identical pixels. This method produces crisp, blocky results without anti-aliasing. If no scaling factors are specified, it defaults to doubling the image size both horizontally and vertically. It's a foundational tool within the extensive Netpbm suite, often used in pipelines for basic monochrome image manipulation.
CAVEATS
pbmpscale is designed exclusively for PBM (monochrome) images and only supports scaling by integer factors. It cannot scale images down or handle fractional scaling. For more versatile scaling options, including scaling other Netpbm formats (PGM/PPM) or non-integer scaling, the command pnmscale should be used instead.
DEFAULT SCALING FACTOR
If neither the -x nor the -y option is specified, pbmpscale will scale the image by a default factor of 2 in both the horizontal and vertical directions.
PIXEL REPLICATION
The scaling operation performed by pbmpscale is based on simple pixel replication. Each pixel in the original PBM image is duplicated 'factor' times horizontally and 'factor' times vertically. This approach preserves sharp edges and is ideal for blocky pixel art or technical diagrams where anti-aliasing is undesirable.
HISTORY
pbmpscale is a component of the comprehensive Netpbm suite, a collection of graphics utilities that evolved from the Pbmplus package, developed in the late 1980s. The design philosophy of Netpbm tools emphasizes simplicity and interoperability through pipes using generic image formats. pbmpscale's method of integer pixel replication reflects this early design, providing a straightforward way to enlarge monochrome images without complex algorithms, aligning with the fundamental nature of the PBM format itself.