# phpman > man > rawtoppm(1)

> **TLDR:** Convert a raw RGB stream to a PPM image.
>
- Convert a raw RGB stream to a PPM image:
  `rawtoppm {{width}} {{height}} {{path/to/image.raw}} > {{path/to/output.ppm}}`
- Convert a raw RGB stream in which the pixels come bottom-first instead of top-first to a PPM image:
  `rawtoppm {{width}} {{height}} {{path/to/image.raw}} | pamflip {{-tb|-topbottom}} > {{path/to/output.ppm}}`
- Ignore the first n bytes of the specified file:
  `rawtoppm {{width}} {{height}} {{-h|-headerskip}} {{n}} {{path/to/image.raw}} > {{path/to/output.ppm}}`
- Ignore the last m bytes of each row in the specified file:
  `rawtoppm {{width}} {{height}} {{-ro|-rowskip}} {{m}} {{path/to/image.raw}} > {{path/to/output.ppm}}`
- Specify the order of color components for each pixel:
  `rawtoppm {{width}} {{height}} -{{rgb|rbg|grb|gbr|brg|bgr}} {{path/to/image.raw}} > {{path/to/output.ppm}}`

*Source: tldr-pages*

---

[rawtoppm(1)](https://www.chedong.com/phpMan.php/man/rawtoppm/1/markdown)                            General Commands Manual                           [rawtoppm(1)](https://www.chedong.com/phpMan.php/man/rawtoppm/1/markdown)



## NAME
       rawtoppm - convert raw RGB bytes into a portable pixmap

## SYNOPSIS
       **rawtoppm**  [**-headerskip** _N_] [**-rowskip** _N_] [**-rgb**|**-rbg**|**-grb** |**-gbr**|**-brg**|**-bgr** ] [**-interpixel**|**-inter**‐‐
       **row**] _width_ _height_ [_imagedata_]

## DESCRIPTION
       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** **.**

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

### -rowskip
              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 **-inter**‐‐
              **pixel**, 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 **-in**‐‐
              **terplane**  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 split‐
              ting  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(5)](https://www.chedong.com/phpMan.php/man/ppm/5/markdown), [rawtopgm(1)](https://www.chedong.com/phpMan.php/man/rawtopgm/1/markdown), [rgb3toppm(1)](https://www.chedong.com/phpMan.php/man/rgb3toppm/1/markdown), [pnmflip(1)](https://www.chedong.com/phpMan.php/man/pnmflip/1/markdown)

## AUTHOR
       Copyright (C) 1991 by Jef Poskanzer.



                                          06 February 1991                               [rawtoppm(1)](https://www.chedong.com/phpMan.php/man/rawtoppm/1/markdown)
