Linux Commands Examples

A great documentation place for Linux commands


convert raw RGB bytes into a portable pixmap

see also : rawtopgm - rgb3toppm - pnmflip


rawtoppm [-headerskip N] [-rowskip N] [-rgb|-rbg|-grb |-gbr|-brg|-bgr ] [-interpixel|-interrow] width height [imagedata]

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!


no example yet ...

... Feel free to add your own example above to help other Linux-lovers !


Reads raw RGB bytes as input. Produces a portable pixmap as output. The input file is just RGB bytes. You have to specify the width and height on the command line, since the program obviously can’t get them from the file. The maxval is assumed to be 255. If the resulting image is upside down, run it through pnmflip -tb .



If the file has a header, you can use this flag to skip over it.


If there is padding at the ends of the rows, you can skip it with this flag.

-rgb -rbg -grb -gbr -brg -bgr

These flags let you specify alternate color orders. The default is -rgb.

-interpixel -interrow

These flags let you specify how the colors are interleaved. The default is -interpixel, meaning interleaved by pixel. A byte of red, a byte of green, and a byte of blue, or whatever color order you specified. -interrow means interleaved by row - a row of red, a row of green, a row of blue, assuming standard rgb color order. An -interplane flag - all the red pixels, then all the green, then all the blue - would be an obvious extension, but is not implemented. You could get the same effect by splitting the file into three parts (perhaps using dd), turning each part into a PGM file with rawtopgm, and then combining them with rgb3toppm.

see also

ppm, rawtopgm , rgb3toppm , pnmflip


Copyright (C) 1991 by Jef Poskanzer.

How can this site be more helpful to YOU ?

give  feedback