Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!EXPO.LCS.MIT.EDU!rws From: rws@EXPO.LCS.MIT.EDU (Bob Scheifler) Newsgroups: comp.windows.x Subject: Re: Fwd: How to get RGB values from XImage data Message-ID: <8909011227.AA03855@expire.lcs.mit.edu> Date: 1 Sep 89 12:27:15 GMT References: <4981@portia.Stanford.EDU> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 17 The file format used by xwd is "documented" in the header file plus the xwd/xwud code. The contents, in order: header name color data image data The pixel values in the image data index the colormap (described by the color data) to yield RGB values. The exact method of indexing depends on the visual class described in the header, and potentially on the RGB masks in the header. However, for a 24-bit DirectColor image, assuming you have a vanilla MIT R2 or R3 xwd (Ardent may have fixed this), the color data will not be present in the file. In that case, you can just use the RGB masks in the header to directly decompose each pixel value into RGB subfields. Other entries in the header (byte_order, bitmap_unit, bitmap_pad) give the details of how the pixels are stored in the image data. Formats are described in the X protocol document (page 357 in the Digital Press book).