LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pnmscale

Scale PNM images (obsoleted by pamscale)

TLDR

Scale by factor
$ pnmscale [0.5] [input.pnm] > [output.pnm]
copy
Scale to specific width
$ pnmscale -width [640] [input.pnm] > [output.pnm]
copy
Scale to specific dimensions
$ pnmscale -width [800] -height [600] [input.pnm] > [output.pnm]
copy
Scale by X and Y factors
$ pnmscale -xscale [2] -yscale [1.5] [input.pnm] > [output.pnm]
copy

SYNOPSIS

pnmscale [options] [pnmfile]

DESCRIPTION

pnmscale scales PNM images up or down. It uses pixel mixing for smooth results when scaling down. This command was obsoleted by pamscale as of Netpbm 10.20 (January 2004) and removed in Netpbm 10.46 (March 2009). Use pamscale for new work, which is backward-compatible and supports PAM images.Part of the Netpbm toolkit.

PARAMETERS

-width n

Output width.
-height n
Output height.
-xscale n
Horizontal scale factor.
-yscale n
Vertical scale factor.
-reduce n
Reduce by integer factor.
-xysize x y
Fit within dimensions (synonym for -xyfit in pamscale).
-pixels n
Scale to a given total number of pixels.

EXAMPLES

$ # Half size
pnmscale 0.5 image.ppm > half.ppm

# Specific width, maintain aspect
pnmscale -width 640 image.ppm > resized.ppm

# Exact dimensions
pnmscale -width 800 -height 600 image.ppm > exact.ppm

# Integer reduction (faster)
pnmscale -reduce 4 huge.ppm > quarter.ppm

# Chain with conversion
jpegtopnm photo.jpg | pnmscale 0.25 | pnmtojpeg > thumb.jpg
copy

CAVEATS

Obsoleted by pamscale; use pamscale for new work. Pixel mixing can blur. Integer reduction (-reduce) is faster than fractional scaling.

HISTORY

pnmscale is part of Netpbm by Jef Poskanzer, later superseded by pamscale with additional features.

SEE ALSO

pamscale(1), pnmenlarge(1), pnmcut(1), netpbm(1)

Copied to clipboard
Kai