LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pamcut

extracts a rectangular region from a PAM or PNM image

TLDR

Cut region from image
$ pamcut [x] [y] [width] [height] [input.pam] > [output.pam]
copy
Cut from coordinates
$ pamcut -left [100] -top [50] -width [200] -height [150] [input.pam] > [output.pam]
copy
Cut right portion
$ pamcut -right [100] -bottom [100] -width [200] -height [200] [input.pam] > [output.pam]
copy
Pad if outside bounds
$ pamcut -pad -left [-10] -top [-10] -width [300] -height [300] [input.pam] > [output.pam]
copy

SYNOPSIS

pamcut [options] [x y width height] [pamfile]

DESCRIPTION

pamcut extracts a rectangular region from a PAM or PNM image. Coordinates can be specified from any corner using combinations of left/right and top/bottom.

PARAMETERS

-left x

Left edge position.
-right x
Right edge position.
-top y
Top edge position.
-bottom y
Bottom edge position.
-width w
Output width.
-height h
Output height.
-pad
Pad with black if outside.

EXAMPLE

$ # Cut 100x100 from top-left corner
pamcut 0 0 100 100 photo.ppm > crop.ppm

# Cut center region
pamcut -left 100 -top 100 -width 200 -height 200 input.ppm > center.ppm
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

Coordinates are 0-indexed. Without -pad, region must be within image bounds.

HISTORY

pamcut is part of Netpbm, evolving from the original PBMplus toolkit created by Jef Poskanzer.

SEE ALSO

pnmcut(1), pamcomp(1), pamscale(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