[xlib] howto create screenshots?

Glynn Clements glynn at gclements.plus.com
Tue Sep 13 14:02:26 PDT 2005


Clemens Eisserer wrote:

> Hi again and sorry for nerving with my neverendingq uestions :-(
> 
> > > Any ideas where to find informations regarding the format of this image?
> > 
> > /usr/include/X11/XWDFile.h
> 
> Thanks for pointing that out, hmm I should have found it myself ;-)
> The main-problem seems to be that I want to read the file into java,
> so I can't simply read the data binary and tell C its this and that
> structure :-(
> 
> However I was not able to extract how the pixel-data itself are stored
> and when (byte-offset from file-begin) they start. Any ideas how the
> pixels are stored?

They are stored however they're actually stored in the frame buffer. 
For a hardware X server, that's likely to be whatever format is most
convenient for the graphics hardware. Note that this can be either
bit-planes (pixmap_format == XYPixmap) or packed pixels
(pixmap_format == ZPixmap).

The whole point of that 25-field XWDFileHeader structure is to specify
the format of what follows (for colour-mapped data, there will be a
colour palette as well as the pixel data).

Given the wide variety of formats which can be used, you will probably
want to look at the code from some existing tool, e.g. xwdtopnm from
the netpbm package.

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list