{{short description|Command-line program and file format}} {{About|the computer program|the all-wheel drive system|Saab XWD}} {{Nofootnotes|date=June 2008}} {{Lowercase title}} 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.<ref> {{cite book | last1 = Tyler | first1 = Chris | title = X Power Tools | url = https://books.google.com/books?id=X9YRMIA899gC | series = O'Reilly Series | publisher = O'Reilly Media, Inc. | publication-date = 2008 | page = 107 | isbn = 9780596101954 | access-date = 2014-01-23 | quote = 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. }} </ref>
<code>xwd</code> 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 == 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 <code>GetImage</code> request (this is done by the <code>XGetImage</code> 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, and the GIMP, or converted to other formats; the ImageMagick suite allows the construction of a useful pipeline:
$ xwd | convert xwd:- screenshot.png
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.
<!-- Intentionally immediately before section == Image format == --> {{Infobox file format | name = X Window Dump | extension = <code>.xwd</code> | icon = | iconcaption = | screenshot = | caption = | owner = X Window System | released = X10 / {{Start date and age|1985}} | latest release version = X11 | latest release date = {{Start date and age|1987|09}} | genre = Image file formats | standard = xwdfile.h<ref name="xwd">{{cite book |title=Encyclopedia of Graphics File Formats, Second Edition |date=April 1996 |author1=James D. Murray |author2=William vanRyper |isbn=1-56592-161-5 |publisher=O'Reilly |url-access=registration |url=https://archive.org/details/mac_Graphics_File_Formats_Second_Edition_1996 |access-date=2014-02-27}}</ref> | open = MIT license | containerfor = | containedby = | extendedfrom = | extendedto = }}
== Image format == Various image viewers and tools support the X11 <code>.xwd</code> 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 '''r'''ed-'''g'''reen-'''b'''lue-'''a'''lpha, ''4'' or ''8'' stands for 16 or 256 colors, ''le'' or ''be'' is the endianness, ''pal'' is an input palette, etc. as listed by <code>ffmpeg –pix_fmts</code>.<ref>{{cite web|url=http://www.ffmpeg.org/general.html#Image-Formats|title=Image Formats|work=FFmpeg General Documentation|year=2014|access-date=2014-02-23}}</ref>
Details of the <code>.xwd</code> format in <code>XWDFile.h</code> depend on the platform, therefore it is unsuited for cross-platform applications and has no MIME image type.<ref name="xwd" />
== See also == * X BitMap (XBM) * X PixMap (XPM)
== References == {{reflist}}
== External links == * xwd is part of X11's standard distribution, but its source can also be downloaded separately as [http://ftp.x.org/pub/current/src/app/xwd-1.0.5.tar.bz2 tar.bz2] or [http://ftp.x.org/pub/current/src/app/xwd-1.0.5.tar.gz tar.gz] * [https://metacpan.org/module/Image::XWD Image::XWD] Perl package at CPAN
{{Graphics file formats}} Category:Graphics file formats Category:X Window System Category:X Window programs Category:Free screenshot software Category:1985 introductions Category:Software using the MIT license Category:Command-line graphics software