pnmscale
Resize PNM images by scaling
TLDR
Scale by factor
$ pnmscale [0.5] [input.pnm] > [output.pnm]
Scale to specific width$ pnmscale -width [640] [input.pnm] > [output.pnm]
Scale to specific dimensions$ pnmscale -width [800] -height [600] [input.pnm] > [output.pnm]
Scale by X and Y factors$ pnmscale -xscale [2] -yscale [1.5] [input.pnm] > [output.pnm]
SYNOPSIS
pnmscale [options] [pnmfile]
DESCRIPTION
pnmscale scales PNM images up or down. It uses pixel mixing for smooth results when scaling down. Obsoleted by pamscale with more features.
Part of 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.
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
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
CAVEATS
Use pamscale for new work. Pixel mixing can blur. Integer reduction is faster.
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)
