LinuxCommandLibrary

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

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)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community