LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pamslice

extract a single row or column from a Netpbm image as text

TLDR

Extract a horizontal slice (row) from an image
$ pamslice -row=[100] [input.pam]
copy
Extract a vertical slice (column) from an image
$ pamslice -column=[50] [input.pam]
copy
Extract only the red plane (plane 0) of a row
$ pamslice -row=[100] -plane=[0] [input.ppm]
copy
Format output for xmgr plotting
$ pamslice -row=[100] -xmgr [input.pam]
copy

SYNOPSIS

pamslice {-row=rownumber | -column=columnnumber} [-plane=planenumber] [-xmgr] [imagefile]

DESCRIPTION

pamslice extracts one line of pixels (a row or column) from a Netpbm image and prints the sample values as ASCII decimal numbers. The first number on each output line is the position index (column number for row slices, row number for column slices), followed by the sample values for each plane.This is useful for generating profile data from images, such as plotting intensity values along a scanline for image analysis. The output can be fed directly into plotting tools like xmgr using the -xmgr option.Either -row or -column must be specified, but not both.

PARAMETERS

IMAGEFILE

Input PAM, PBM, PGM, or PPM image file. Reads from standard input if omitted.
-row=N
Extract row N as a horizontal slice. Rows are numbered from the top starting with 0.
-column=N
Extract column N as a vertical slice. Columns are numbered from the left starting with 0.
-plane=N
Restrict output to a single color plane. For PPM images: 0=red, 1=green, 2=blue. Omit for all planes.
-xmgr
Format output as input for the xmgr plotting program by adding header information.

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

Part of Netpbm. Output is plain text only, not an image. Row and column numbering starts at 0.

HISTORY

pamslice is part of the Netpbm toolkit for image manipulation and analysis. It was added as a tool for extracting profile data from images.

SEE ALSO

pamcut(1), pamfile(1), pamtopnm(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