LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pnmcut

Extract rectangular region from PNM images

TLDR

Cut rectangular region
$ pnmcut [x] [y] [width] [height] [input.pnm] > [output.pnm]
copy
Cut from top-left corner
$ pnmcut -left [0] -top [0] -width [100] -height [100] [input.pnm] > [output.pnm]
copy
Cut using bottom-right
$ pnmcut -left [10] -top [10] -right [200] -bottom [150] [input.pnm] > [output.pnm]
copy
Pad if outside bounds
$ pnmcut -pad [x] [y] [width] [height] [input.pnm] > [output.pnm]
copy

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
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

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.

SEE ALSO

pamcut(1), pnmpaste(1), pnmcrop(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