{
    "mode": "man",
    "parameter": "xwdtopnm",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/xwdtopnm/1/json",
    "generated": "2026-08-09T18:42:26Z",
    "synopsis": "xwdtopnm [-verbose] [-headerdump] [xwdfile]",
    "sections": {
        "NAME": {
            "content": "xwdtopnm - convert an X11 or X10 window dump file to a PNM image\n\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "xwdtopnm [-verbose] [-headerdump] [xwdfile]\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This program is part of Netpbm(1).\n\nxwdtopnm  reads  an  X11 or X10 window dump file as input and produces a PNM image as output.\nThe type of the output image depends on the input file - if it's black and white, the  output\nis  PBM.   If it's grayscale, the output is PGM.  Otherwise, it's PPM.  The program tells you\nwhich type it is writing.\n\nUsing this program, you can convert anything you can display on  an  X  workstation's  screen\ninto a PNM image.  Just display whatever you're interested in, run the xwd program to capture\nthe  contents  of the window, run it through xwdtopnm, and then use pamcut to select the part\nyou want.\n\nNote that a pseudocolor XWD image (typically what you get when you make a dump of  a  pseudo‐\ncolor X window) has maxval 65535, which means the PNM file that xwdtopnm generates has maxval\n65535.   Many  older  image  processing  programs (that aren't part of the Netpbm package and\ndon't use the Netpbm programming library) don't know how to handle a PNM  image  with  maxval\ngreater  than  255 (because there are two bytes instead of one for each sample in the image).\nSo you may want to run the output of xwdtopnm through pamdepth before feeding it  to  one  of\nthese old programs.\n\nxwdtopnm  can't  convert every kind of XWD image (which essentially means it can't convert an\nXWD created from every kind of X display configuration).  In particular,  it  cannot  convert\none with more than 24 bits per pixel.\n\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "In  addition  to  the options common to all programs based on libnetpbm (most notably -quiet,\nsee \u001b]8;;index.html#commonoptions\u001b\\ Common Options\u001b]8;;\u001b\\ ), xwdtopnm recognizes the following command line options:\n\n\n",
            "subsections": [
                {
                    "name": "-verbose",
                    "content": "This option causes xwdtopnm to display handy information about the input image and the\nconversion process\n\n"
                },
                {
                    "name": "-headerdump",
                    "content": "This option causes xwdtopnm to display the contents of the X11 header.  It has no  ef‐\nfect when the input is X10.  This option was new in Netpbm 10.26 (December 2004).\n\n\n\n"
                }
            ]
        },
        "NOTES": {
            "content": "",
            "subsections": [
                {
                    "name": "Two Byte Samples",
                    "content": "xwdtopnm  sometimes  produces  output with a maxval greater than 255, which means the maximum\nvalue of a sample (one intensity value, e.g. the red component of a pixel)  is  greater  than\n255 and therefore each sample takes 2 bytes to represent.  This can be a problem because some\nprograms expect those bytes in a different order from what the Netpbm format specs say, which\nis  what  xwdtopnm  produces,  which  means  they will see totally different colors than they\nshould.   xv is one such program.\n\nIf this is a problem (e.g. you want to look at the output of xwdtopnm with xv), there are two\nways to fix it:\n\n\n\n•      Pass the output through pamendian to produce the format the program expects.\n\n•      Pass the output through pamdepth to reduce the maxval below 256 so there is  only  one\nbyte per sample.\n\n\nOften, there is no good reason to have a maxval greater than 255.  It happens because in XWD,\nbut  not  PNM,  each  color component of a pixel can have different resolution, for example 5\nbits for blue (maxval 31), 5 bits for red (maxval 31), and 6 bits for green (maxval 63),  for\na  total of 16 bits per pixel.  In order to reproduce the colors as closely as possible, xwd‐\ntopnm has to use a large maxval.  In this example, it would use 31 * 63 = 1953,  and  use  48\nbits per pixel.\n\nBecause  this  is  a common and frustrating problem when using xwdtopnm, the program issues a\nwarning whenever it generates output with two byte samples.  You can quiet this warning  with\nthe -quiet \u001b]8;;index.html#commonoptions\u001b\\common option\u001b]8;;\u001b\\ .  The warning was new in Netpbm 10.46 (March 2009).\n\n\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "pnmtoxwd(1), pamendian(1), pamdepth(1), pnm(1), xwd man page\n\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Copyright (C) 1989, 1991 by Jef Poskanzer.\n",
            "subsections": []
        },
        "DOCUMENT SOURCE": {
            "content": "This  manual  page  was  generated by the Netpbm tool 'makeman' from HTML source.  The master\ndocumentation is at\n\nhttp://netpbm.sourceforge.net/doc/xwdtopnm.html\n\nnetpbm documentation                       08 January 2010                   Xwdtopnm User Manual(1)",
            "subsections": []
        }
    },
    "summary": "xwdtopnm - convert an X11 or X10 window dump file to a PNM image",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option causes xwdtopnm to display handy information about the input image and the conversion process"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option causes xwdtopnm to display the contents of the X11 header. It has no ef‐ fect when the input is X10. This option was new in Netpbm 10.26 (December 2004)."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "pnmtoxwd",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmtoxwd/1/json"
        },
        {
            "name": "pamendian",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pamendian/1/json"
        },
        {
            "name": "pamdepth",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pamdepth/1/json"
        },
        {
            "name": "pnm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnm/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Convert an X11 or X10 window dump file to PNM.",
        "examples": [
            {
                "description": "Convert a XWD image file to PBM",
                "command": "xwdtopnm {{path/to/input_file.xwd}} > {{path/to/output_file.pnm}}"
            },
            {
                "description": "Display information about the conversion process",
                "command": "xwdtopnm {{-verb|-verbose}} {{path/to/input_file.xwd}} > {{path/to/output_file.pnm}}"
            },
            {
                "description": "Display the contents of the X11 header of the input file",
                "command": "xwdtopnm {{-h|-headerdump}} {{path/to/input_file.xwd}} > {{path/to/output_file.pnm}}"
            }
        ]
    }
}