pnmcut
Extract rectangular region from PNM images
TLDR
Cut rectangular region
$ pnmcut [x] [y] [width] [height] [input.pnm] > [output.pnm]
Cut from top-left corner$ pnmcut -left [0] -top [0] -width [100] -height [100] [input.pnm] > [output.pnm]
Cut using bottom-right$ pnmcut -left [10] -top [10] -right [200] -bottom [150] [input.pnm] > [output.pnm]
Pad if outside bounds$ pnmcut -pad [x] [y] [width] [height] [input.pnm] > [output.pnm]
SYNOPSIS
pnmcut [options] x y width height [pnmfile]
DESCRIPTION
pnmcut extracts a rectangular region from a PNM image. Coordinates are zero-indexed from top-left corner.
Part of Netpbm toolkit for image manipulation.
PARAMETERS
-left n
Left column.-right n
Right column.-top n
Top row.-bottom n
Bottom row.-width n
Width in pixels.-height n
Height in pixels.-pad
Pad with black if out of bounds.
EXAMPLES
$ # Cut 100x100 from position 50,50
pnmcut 50 50 100 100 image.ppm > crop.ppm
# Using named parameters
pnmcut -left 100 -top 100 -width 200 -height 150 image.ppm > crop.ppm
# Cut with padding
pnmcut -pad -10 -10 120 120 image.ppm > padded.ppm
# Chain with conversion
jpegtopnm photo.jpg | pnmcut 0 0 640 480 | pnmtojpeg > thumb.jpg
pnmcut 50 50 100 100 image.ppm > crop.ppm
# Using named parameters
pnmcut -left 100 -top 100 -width 200 -height 150 image.ppm > crop.ppm
# Cut with padding
pnmcut -pad -10 -10 120 120 image.ppm > padded.ppm
# Chain with conversion
jpegtopnm photo.jpg | pnmcut 0 0 640 480 | pnmtojpeg > thumb.jpg
CAVEATS
Superseded by pamcut with more features. Negative coordinates cut from opposite edge.
HISTORY
pnmcut is part of Netpbm by Jef Poskanzer, providing basic cropping functionality.
