← 返回命令列表

Linux command

rawtopgm 命令

文本

涉及管道、覆盖或删除,执行前请先确认路径和参数。

常用示例

Convert raw grayscale to PGM

rawtopgm [width] [height] [input.raw] > [output.pgm]

Convert with header bytes to skip

rawtopgm -headerskip [512] [width] [height] [input.raw] > [output.pgm]

说明

rawtopgm converts raw grayscale byte data into Portable Graymap (PGM) format by interpreting a stream of pixel values according to specified image dimensions. Since raw data contains no metadata, the width and height must be provided as arguments so the tool knows how to arrange the bytes into a proper image grid. The -headerskip option allows skipping file headers that precede the actual pixel data, and -bpp handles 16-bit samples for higher dynamic range images. It is part of the Netpbm image processing toolkit.

参数

-headerskip _BYTES_
Skip the first _BYTES_ bytes of the input before reading pixel data (for files with proprietary headers).
-rowskip _BYTES_
Skip _BYTES_ at the end of each scanline (e.g., padding to a row stride).
-bpp _N_
Bytes per pixel: _1_ (default, 8-bit) or _2_ (16-bit big-endian samples).
-littleendian
When -bpp 2, interpret 16-bit samples as little-endian.
-maxval _N_
Override the maxval written to the output PGM (default _255_, or _65535_ when -bpp 2).
-topbottom
Treat row 0 as the top of the image (default; pair with -bottomtop to flip).
-bottomtop
Treat row 0 as the bottom of the image.

FAQ

What is the rawtopgm command used for?

rawtopgm converts raw grayscale byte data into Portable Graymap (PGM) format by interpreting a stream of pixel values according to specified image dimensions. Since raw data contains no metadata, the width and height must be provided as arguments so the tool knows how to arrange the bytes into a proper image grid. The -headerskip option allows skipping file headers that precede the actual pixel data, and -bpp handles 16-bit samples for higher dynamic range images. It is part of the Netpbm image processing toolkit.

How do I run a basic rawtopgm example?

Run `rawtopgm [width] [height] [input.raw] > [output.pgm]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -headerskip _BYTES_ do in rawtopgm?

Skip the first _BYTES_ bytes of the input before reading pixel data (for files with proprietary headers).