{
    "mode": "man",
    "parameter": "rawtoppm",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/rawtoppm/1/json",
    "generated": "2026-06-17T11:04:36Z",
    "synopsis": "rawtoppm  [-headerskip N] [-rowskip N] [-rgb|-rbg|-grb |-gbr|-brg|-bgr ] [-interpixel|-inter‐‐\nrow] width height [imagedata]",
    "sections": {
        "NAME": {
            "content": "rawtoppm - convert raw RGB bytes into a portable pixmap\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "rawtoppm  [-headerskip N] [-rowskip N] [-rgb|-rbg|-grb |-gbr|-brg|-bgr ] [-interpixel|-inter‐‐\nrow] width height [imagedata]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Reads raw RGB bytes as input.  Produces a portable pixmap as output.  The input file is  just\nRGB  bytes.   You have to specify the width and height on the command line, since the program\nobviously can't get them from the file.  The maxval is assumed to be 255.  If  the  resulting\nimage is upside down, run it through pnmflip -tb .\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-headerskip",
                    "content": "If the file has a header, you can use this flag to skip over it.\n"
                },
                {
                    "name": "-rowskip",
                    "content": "If there is padding at the ends of the rows, you can skip it with this flag.\n"
                },
                {
                    "name": "-rgb -rbg -grb -gbr -brg -bgr",
                    "content": "These flags let you specify alternate color orders.  The default is -rgb.\n"
                },
                {
                    "name": "-interpixel -interrow",
                    "content": "These  flags  let  you specify how the colors are interleaved.  The default is -inter‐‐\npixel, meaning interleaved by pixel.  A byte of red, a byte of green, and  a  byte  of\nblue,  or  whatever color order you specified.  -interrow means interleaved by row - a\nrow of red, a row of green, a row of blue, assuming standard rgb color order.  An -in‐‐\nterplane  flag  - all the red pixels, then all the green, then all the blue - would be\nan obvious extension, but is not implemented.  You could get the same effect by split‐\nting  the  file into three parts (perhaps using dd), turning each part into a PGM file\nwith rawtopgm, and then combining them with rgb3toppm.\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "ppm(5), rawtopgm(1), rgb3toppm(1), pnmflip(1)\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Copyright (C) 1991 by Jef Poskanzer.\n\n\n\n06 February 1991                               rawtoppm(1)",
            "subsections": []
        }
    },
    "summary": "rawtoppm - convert raw RGB bytes into a portable pixmap",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "If the file has a header, you can use this flag to skip over it."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "If there is padding at the ends of the rows, you can skip it with this flag."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "These flags let you specify alternate color orders. The default is -rgb."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "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."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "ppm",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/ppm/5/json"
        },
        {
            "name": "rawtopgm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/rawtopgm/1/json"
        },
        {
            "name": "rgb3toppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/rgb3toppm/1/json"
        },
        {
            "name": "pnmflip",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmflip/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Convert a raw RGB stream to a PPM image.",
        "examples": [
            {
                "description": "Convert a raw RGB stream to a PPM image",
                "command": "rawtoppm {{width}} {{height}} {{path/to/image.raw}} > {{path/to/output.ppm}}"
            },
            {
                "description": "Convert a raw RGB stream in which the pixels come bottom-first instead of top-first to a PPM image",
                "command": "rawtoppm {{width}} {{height}} {{path/to/image.raw}} | pamflip {{-tb|-topbottom}} > {{path/to/output.ppm}}"
            },
            {
                "description": "Ignore the first n bytes of the specified file",
                "command": "rawtoppm {{width}} {{height}} {{-h|-headerskip}} {{n}} {{path/to/image.raw}} > {{path/to/output.ppm}}"
            },
            {
                "description": "Ignore the last m bytes of each row in the specified file",
                "command": "rawtoppm {{width}} {{height}} {{-ro|-rowskip}} {{m}} {{path/to/image.raw}} > {{path/to/output.ppm}}"
            },
            {
                "description": "Specify the order of color components for each pixel",
                "command": "rawtoppm {{width}} {{height}} -{{rgb|rbg|grb|gbr|brg|bgr}} {{path/to/image.raw}} > {{path/to/output.ppm}}"
            }
        ]
    }
}