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

INSTALL

sudo apt install netpbm
copy
sudo dnf install netpbm
copy
sudo pacman -S netpbm
copy
sudo apk add netpbm
copy
sudo zypper install netpbm
copy
brew install netpbm
copy
nix profile install nixpkgs#netpbm
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)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid