summary refs log tree commit diff
path: root/xwdtopnm.html
blob: aa9d73ce65596b0e1123a3488a609d7743dec18b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN">
<html><head><title>Xwdtopnm User Manual</title></head>
<body>
<h1>xwdtopnm</h1>
Updated: 08 January 2010
<br>
<a href="#index">Table Of Contents</a>

<h2>NAME</h2>
xwdtopnm - convert an X11 or X10 window dump file to a PNM image

<h2 id="synopsis">SYNOPSIS</h2>

<b>xwdtopnm</b>
[<b>-verbose</b>]
[<b>-headerdump</b>]
[<i>xwdfile</i>]

<h2 id="description">DESCRIPTION</h2>

<p>This program is part of <a href="index.html">Netpbm</a>.

<p><b>xwdtopnm</b> reads an X11 or X10 window dump file as input and
produces a PNM image as output.  The type of the output image depends
on the input file - if it's black and white, the output is PBM.  If
it's grayscale, the output is PGM.  Otherwise, it's PPM.  The program
tells you which type it is writing.

<p>Using 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 <b>xwd</b> program to capture the contents of
the window, run it through <b>xwdtopnm</b>, and then use <b>pamcut</b>
to select the part you want.

<p>Note that a pseudocolor XWD image (typically what you get when you
make a dump of a pseudocolor X window) has maxval 65535, which means
the PNM file that <b>xwdtopnm</b> generates has maxval 65535.  Many
older image processing programs (that aren't part of the Netpbm
package and don't use the Netpbm programming library) don't 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 of <b>xwdtopnm</b> through <b>pamdepth</b>
before feeding it to one of these old programs.

<p><b>xwdtopnm</b> 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.


<h2 id="options">OPTIONS</h2>

<p>In addition to the options common to all programs based on libnetpbm
(most notably <b>-quiet</b>, see <a href="index.html#commonoptions">
Common Options</a>), <b>xwdtopnm</b> recognizes the following
command line options:

<dl>
<dt><b>-verbose</b>
<dd>This option causes <b>xwdtopnm</b> to display handy information about the
input image and the conversion process

<dt><b>-headerdump</b>

<dd>This option causes <b>xwdtopnm</b> to 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).

</dl>

<h2 id="notes">NOTES</h2>

<h3 id="twobytesamples">Two Byte Samples</h3>

<p><b>xwdtopnm</b> 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 <b>xwdtopnm</b> produces, which means they will see totally
different colors than they should.   <b>xv</b> is one such program.

<p>If this is a problem (e.g. you want to look at the output of <b>xwdtopnm</b>
with <b>xv</b>), there are two ways to fix it:

<ul>
<li>Pass the output through <b>pamendian</b> to produce the format the
program expects.
<li>Pass the output through <b>pamdepth</b> to reduce the maxval below 256
so there is only one byte per sample.
</ul>

<p>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,
<b>xwdtopnm</b> has to use a large maxval.  In this example, it would use
31 * 63 = 1953, and use 48 bits per pixel.

<p>Because this is a common and frustrating problem when using <b>xwdtopnm</b>,
the program issues a warning whenever it generates output with two byte
samples.  You can quiet this warning with the <b>-quiet</b> <a href="index.html#commonoptions">common option</a>.  The warning was new in Netpbm 10.46
(March 2009).


<h2 id="seealso">SEE ALSO</h2>

<a href="pnmtoxwd.html">pnmtoxwd</a>,
<a href="pamendian.html">pamendian</a>,
<a href="pamdepth.html">pamdepth</a>,
<a href="pnm.html">pnm</a>,
<b>xwd</b> man page

<h2 id="author">AUTHOR</h2>

Copyright (C) 1989, 1991 by Jef Poskanzer.

<hr>

<h2 id="index">Table Of Contents</h2>
<ul>
<li><a href="#synopsis">SYNOPSIS</a>
<li><a href="#description">DESCRIPTION</a>
<li><a href="#options">OPTIONS</a>
<li><a href="#notes">NOTES</a>
  <ul>
  <li><a href="#twobytesamples">Two Byte Samples</a>
  </ul>
<li><a href="#seealso">SEE ALSO</a>
<li><a href="#author">AUTHOR</a>
</ul>
</body>
</html>