Edge Rewrite
Jump to content

xwd

From Wikipedia, the free encyclopedia
(Redirected from XWD)

In the X Window System, the program xwd (X Window dump) captures the content of a screen or of a window and optionally saves it into a file.[1]

xwd runs in one of two ways: if a user specifies the whole screen or the name or identifier of a window as an argument, the program captures the content of the window; otherwise, it changes the shape of the cursor and waits for the user to click in a window, whose content is then captured.

Operation

[edit]

At the X Window core protocol level, xwd uses the fact that any X client can request the content of an arbitrary window, including ones it did not create, using the GetImage request (this is done by the XGetImage function in the Xlib library). The content of the whole screen is obtained by requesting the content of the root window.

The file generated by xwd can then be read by various other X utilities such as xwud, sxwd, xv, netpbm, xloadimage /xli, and the GIMP, or converted to other formats; the ImageMagick suite allows the construction of a useful pipeline, as does netpbm:

$ xwd | convert xwd:- screenshot.png
$ tifftopnm o37122g7.tif | pnmquant 16 -psuedodepth 8 | pnmtoxwd | gzip -c > o37122g7.xwd.gz

The dumps are larger in size than files in most image file formats – not only compressed formats such as PNG, but also uncompressed bitmap formats like BMP. Gzipped, however, they tend to be slightly smaller than their png counterparts, and many utilities including ImageMagick and xloadimage/xli handle gzipped files automatically.

The xwd format supports a wide variety of colormap types. Sxwd exists to inspect and modify the colormap of 8-bit palleted images, as:

$ sxwd -in o37122a1aa.200.xwd.gz -cmap
Number of colors: 12   whitePixel:  blackPixel: 0
	16b	16b	16b	R-MSB	R-LSB	G-MSB	G-LSB	B-MSB	B-LSB
0	0	0	0	0	0	0	0	0	0
1	23130	40606	58853	90	90	158	158	229	229
2	65278	65278	65278	254	254	254	254	254	254
3	41377	24415	17990	161	161	95	95	70	70
4	51657	57568	62708	201	201	224	224	244	244
5	50372	25700	50372	196	196	100	100	196	196
6	65278	51657	50372	254	254	201	201	196	196
7	58853	11308	7453	229	229	44	44	29	29
8	53713	65278	45232	209	209	254	254	176	176
9	63993	51657	63993	249	249	201	201	249	249
10	58853	58853	58853	229	229	229	229	229	229
11	56797	42662	37265	221	221	166	166	145	145
X Window Dump
Filename extension
.xwd
Developed byX Window System
Initial releaseX10 / 1985; 41 years ago (1985)
Latest release
X11
September 1987; 39 years ago (1987-09)
Type of formatImage file formats
Standardxwdfile.h[2]
Open format?MIT license

Image format

[edit]

Various image viewers and tools support the X11 .xwd format, among others the GIMP, ImageMagick, Netpbm, and XnView. In version 2.1.4 FFmpeg supported pixel formats bgra, rgba, argb, abgr, rgb24, bgr24, rgb565be, rgb565le, bgr565be, bgr565le, rgb555be, rgb555le, bgr555be, bgr555le, rgb8, bgr8, rgb4_byte, bgr4_byte, pal8, gray, and monow. In these abbreviations 555 means 32768=32×32×32 colors, 565 means 65536 colors (6 bits for green), rgba is red-green-blue-alpha, 4 or 8 stands for 16 or 256 colors, le or be is the endianness, pal is an input palette, etc. as listed by ffmpeg –pix_fmts.[3]

Details of the .xwd format in XWDFile.h depend on the platform, therefore it is unsuited for cross-platform applications and has no MIME image type.[2] Another way of looking at this is that it is suited for cross-platform development with a small coding effort made to resolve the architecture differences, as it requires no library to use.

See also

[edit]

References

[edit]
  1. ↑ Tyler, Chris (2008). X Power Tools. O'Reilly Series. O'Reilly Media, Inc. p. 107. ISBN 9780596101954. Retrieved 2014-01-23. The X window dump (xwd) tool takes a snapshot of the current screen, a manually selected window or a window designated by its numeric ID, and outputs the image to standard output or to a file.
  2. 1 2 James D. Murray; William vanRyper (April 1996). Encyclopedia of Graphics File Formats, Second Edition. O'Reilly. ISBN 1-56592-161-5. Retrieved 2014-02-27.
  3. ↑ "Image Formats". FFmpeg General Documentation. 2014. Retrieved 2014-02-23.
[edit]