XWDTOPNM(1)
π XWDTOPNM π
okay bestie, gather round, because today we're talking about xwdtopnm β and yes, she's part of the Netpbm(1) fam, so you know she's iconic. β¨
β¨ SYNOPSIS β¨
xwdtopnm [-verbose] [-headerdump] [xwdfile]
π¦ DESCRIPTION π¦
So basically: xwdtopnm reads an X11 or X10 window dump file as input and gives you a PNM image as output. no cap. π
and the type of output? it's giving mystery, it's giving it depends on the input, bestie:
- if it's black and white, the output is PBM π€π€
- if it's grayscale, the output is PGM π«οΈ
- otherwise? PPM, obviously. π
and don't worry β the program tells you which type it is writing, so you're never left guessing. main character behavior honestly.
The way that this is useful is literally everything: with this program you can convert anything you can display on an X workstation's screen into a PNM image. π₯οΈβ¨ Just:
- display whatever you're interested in
- run the
xwdprogram to capture the contents of the window - run it through
xwdtopnm - then use
pamcutto select the part you want
boom. snatched. π
β οΈ okay important one, bestie: a pseudocolor XWD image (which is typically what you get when you make a dump of a pseudocolor X window) has maxval 65535, which means the PNM file thatxwdtopnmgenerates has maxval 65535. And a LOT of older image processing programs (the ones that aren't part of the Netpbm package and don't use the Netpbm programming library) simply do not know how to handle a PNM image with maxval greater than 255 β because there are two bytes instead of one for each sample in the image. π So you may want to run the output ofxwdtopnmthroughpamdepthbefore feeding it to one of these old programs. protect yourself fr fr.
also ngl, she's not magic β xwdtopnm can't convert every kind of XWD image (which essentially means it can't convert an XWD created from every kind of X display configuration). In particular, it cannot convert one with more than 24 bits per pixel. periodt.
π OPTIONS π
In addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), xwdtopnm recognizes the following command line options:
-verboseβ this option causesxwdtopnmto display handy information about the input image and the conversion process. she's chatty and we love that for her. π¬β¨-headerdumpβ this option causesxwdtopnmto display the contents of the X11 header. It has no effect when the input is X10. This option was new in Netpbm 10.26 (December 2004). πΈ
π NOTES π
π«Ά Two Byte Samples π«Ά
xwdtopnm sometimes produces output with a maxval greater than 255, which means the maximum value of a sample (one intensity value, e.g. the red component of a pixel) is greater than 255 β and therefore each sample takes 2 bytes to represent. π³
This can be a problem because some programs expect those bytes in a different order from what the Netpbm format specs say, which is what xwdtopnm produces β which means they will see totally different colors than they should. xv is one such program. π
If this is a problem (e.g. you want to look at the output of xwdtopnm with xv), there are two ways to fix it:
- Pass the output through
pamendianto produce the format the program expects. π - Pass the output through
pamdepthto reduce the maxval below 256 so there is only one byte per sample. β¨
Often, there is no good reason to have a maxval greater than 255. It happens because in XWD, but not PNM, each color component of a pixel can have different resolution β for example 5 bits for blue (maxval 31), 5 bits for red (maxval 31), and 6 bits for green (maxval 63), for a total of 16 bits per pixel. π€―
In order to reproduce the colors as closely as possible, xwdtopnm has to use a large maxval. In this example, it would use maxval 31 * 63 = 1953, which requires two bytes per sample, totalling 48 bits per pixel. the math is mathing unfortunately. π
Because this is a common and frustrating problem when using xwdtopnm, the program issues a warning whenever it generates output with two byte samples. π¨ You can quiet this warning with the -quiet common option. The warning was new in Netpbm 10.46 (March 2009).
π SEE ALSO π
pnmtoxwd(1), pamendian(1), pamdepth(1), pnm(1), xwd man page β go read the whole friend group bestie π
π AUTHOR π
Copyright (C) 1989, 1991 by Jef Poskanzer. π«‘
π§ DOCUMENT SOURCE π§
This manual page was generated by the Netpbm tool makeman from HTML source. The master documentation is at:
http://netpbm.sourceforge.net/doc/xwdtopnm.html
okay that's the whole vibe, bestie β xwdtopnm from the Netpbm documentation, dated 08 January 2010. go convert something cute and be your main character self. slay π
β¨π¦π
π¦ where this page comes from
- debian trixie: netpbm 2:11.10.02-1 Β· MIT
- ubuntu resolute: netpbm 2:11.10.02-1build1 Β· MIT
- ubuntu stonking: netpbm 2:11.13.03+ds-2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms