mike@relgyro.stanford.edu (Mike Macgirvin) (01/21/89)
Could somebody explain to me the layout of the image data in a COLOR Sun rasterfile? I understand the header info and a monochrome bitmap, but can't seem to locate an explanation of the color image layout; i.e. how are the various planes stored, and does each byte represent 'intensity' of a pixel, rather than 8 pixels, etc. ? Thanx in advance, _________________________________________________________________________ |\ /| Mike Macgirvin | \ / | | / Stanford Relativity Gyro Experiment | \/ | . | / ___ Stanford University | | | |< | (415) 725-4117 | | | | \ |-- ARPA: mike@relgyro.stanford.edu (36.64.0.50) | | | | \ |___ UUCP: /dev/null _________________________________________________________________________
falk@sun.uucp (Ed Falk) (01/26/89)
In article <179@helens.Stanford.EDU>, mike@relgyro.stanford.edu (Mike Macgirvin) writes: > > Could somebody explain to me the layout of the image data in a > COLOR Sun rasterfile? I understand the header info and a monochrome bitmap, > but can't seem to locate an explanation of the color image layout; i.e. > how are the various planes stored, and does each byte represent 'intensity' > of a pixel, rather than 8 pixels, etc. ? It's quite simple, really. With an 8-bit image, the header is followed by a colormap. The colormap is 256 (nominally) red, 256 green and 256 blue values running from 0-255, representing increasing intensity. The image data consists of 8-bit indices into this table. Notes: o the length of the color table doesn't have to be 256, but 256 is most common and it is possible that you may run into someone's software that can't handle a short colortable. As far as I can tell, all of Sun's software works fine with any length color table. o The colormap length field in the header refers to the total length of r+g+b. If the table is 256 entries, then the header will say the colormap length is 768. o I don't know if the no-colormap case is defined. screenload will load the data into the frame buffer but leave the colormap alone, causing the image to come up with whatever colormap happened to be resident at the time. For this reason, I always put a linear grey ramp in my grey-scale images. My own software treats the pixels as shades of grey when there's no colormap. o 24-bit and 32-bit image formats are or will soon be defined. In these cases, the byte ordering is "bgr" and "abgr" respectively (a is alpha). If a colormap is provided with a 24-bit or 32-bit image, then the rgb values in the image are seperate indices into the rgb color tables respectively. This can be used for gamma-correction. Alpha data is never passed through a colormap. -- -ed falk, sun microsystems sun!falk, falk@sun.com card-carrying ACLU member.