Sun Icon

Also Known As: ICO


Type Bitmap
Colors Mono
Compression None
Maximum Image Size 64x64 pixels
Multiple Images Per File No
Numerical Format Big-endian
Originator Sun Microsystems
Platform SunOS
Supporting Applications Many UNIX-based
See Also Sun Raster

Usage
Used to store iconic images found in the Sun GUI environments.

Comments
Sun Icon is an ASCII representation of a bitmap image format.

Vendor specifications are available for this format.

Code fragments are available for this format.

Sample images are available for this format.


The icons found in the Open Look and SunView Graphical User Interfaces available on the Sun Microsystems UNIX-based platforms are stored in a simple format known as the Sun Icon format.

Contents:
File Organization
File Details
For Further Information

File Organization

Sun Icon files are ASCII text files that may be created and modified using a simple text editor. Sun icons are typically 64x64 pixels in size and contain black-and-white image data. Files contain an ASCII header followed by a hexadecimal representation of the bitmapped image data.

The header is found in the first 78 bytes of the icon file. The header contains five fields of information composed of printable ASCII characters. Each field has a keyword=value syntax and is delineated by a comma and a space character. The header begins and ends with the standard C comment tokens /* */. A linefeed character (ASCII 0Ah) is preset at offset 49h within the header.

File Details

When you use a text editor to examine a Sun Icon header, you can see the format shown below:

/* Format_version=1, Width=64, Height=64, Depth=1, 
   Valid_bits_per_item=16
 */

Format_version is the version of the icon file format and is always 1.

Width and Height are the size of the icon in pixels; both are typically set to a value of 64.

Depth is the number of bits per pixel in the icon image data and is usually 1.

Valid_bits_per_item is the number of bits of image data contained in each item of hexadecimal bitmapped data. Typical values for this field are 16 and 32.

The image data that follows the header is a series of hexadecimal numbers called items. Each item represents a number of pixels equal to the Valid_bits_per_item value divided by the Depth value. For images with a Valid_bits_per_item value of 16 and a Depth of 1, each hexadecimal number represents 16 pixels and is two bytes in size.

Items are separated by commas, and every eighth item is delimited by a linefeed character. All hexadecimal numbers begin with the standard C hexadecimal notational prefix 0x. The following illustration is a complete Sun Icon image file. The <LF> symbols indicate the location of a linefeed character.

/*
Format_version=1,Width=64,Height=64,Depth=1,Valid_bits_per_item=16<LF>
*/<LF>
0x0000,0x0000,0x0000,0x0000,0x01E0,0x3C00,0x0000,0x0000,<LF>
0x1F5C,0xEB00,0x0000,0x0000,0x7AAB,0xB5C0,0x0000,0x0000,<LF>
0xD555,0x6B00,0x0000,0x0000,0xFAAA,0xDC00,0x0000,0xC600,<LF>
0x0FF7,0x0000,0x0001,0x2900,0x0000,0x0000,0x0000,0x1000,<LF>
0x0000,0x0000,0x8000,0x0000,0xE000,0x0000,0x8000,0x0000,<LF>
0x5804,0x0001,0xC318,0x0000,0xAE06,0x0001,0x44A4,0x018C,<LF>
0x5587,0x0001,0xC040,0x0252,0xAE05,0x0001,0x6000,0x0020,<LF>
0xF006,0x8082,0xA000,0x0000,0x0005,0x4083,0x6000,0x0000,<LF>
0x0002,0xC0C2,0xB020,0x0000,0x0003,0x6145,0x5060,0x0000,<LF>
0x0002,0xB1A6,0xB060,0x0000,0x0003,0x5165,0x50A0,0x00C0,<LF>
0x0001,0xB9B6,0xA9A0,0x0340,0x0001,0x575D,0x5940,0x0D80,<LF>
0x0041,0xAAAA,0xAAC0,0x7B00,0x0071,0xD77F,0xD541,0xD500,<LF>
0x803C,0xAF80,0x3EC6,0xAA00,0x602B,0xD815,0x035D,0x5400,<LF>
0x7815,0xE140,0x28EA,0xA800,0x2E1A,0x8400,0x0235,0x5800,<LF>
0x15CB,0x1000,0x009A,0xB000,0x0ABC,0x4000,0x0005,0x6000,<LF>
0x055D,0x0000,0x0022,0xC000,0x0550,0x0000,0x0009,0x4000,<LF>
0x02A4,0x7800,0x0000,0xFFF0,0x01A0,0x8400,0x0002,0xAAA0,<LF>
0x0150,0x8000,0x0000,0x5540,0xFF80,0x8000,0x0001,0x2A80,<LF>
0x55A0,0x80E7,0x3700,0x3500,0x2B00,0x7842,0x1880,0x9B00,<LF>
0x1540,0x0442,0x1080,0x1600,0x1E00,0x0442,0x1080,0x4C00,<LF>
0x0A80,0x8442,0x1080,0x0C00,0x0600,0x8442,0x1080,0x2B80,<LF>
0x0680,0x783C,0x38C0,0x0AF0,0x3C00,0x0000,0x0000,0x155F,<LF>
0xED00,0x0000,0x0000,0x06AC,0x5400,0x0000,0x0000,0x1550,<LF>
0x2D00,0x0000,0x0000,0x06A0,0xFFD5,0x5555,0x5555,0x5FFF,<LF>
0xFF88,0x8888,0x8888,0xB7FF,0xDDE2,0x2222,0x2222,0x5DDD,<LF>
0xBBD4,0x4444,0x4444,0xFBBB,0xFFFF,0xFFFF,0xFFFF,0xFFFF,<LF>
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,<LF>
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,<LF>
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,<LF>
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,<LF>
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,<LF>
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000

For Further Information

For further information about the Sun Icon format, refer to the following files on SunOS systems (and included on our CD-ROM):

/usr/include/suntool/icon.h
/usr/include/suntool/icon_load.h

These files contain the declaration for the Sun Icon format, as well as other information about the format.

You can also contact Sun at:

Sun Microsystems Incorporated
2550 Garcia Avenue
Mountain View, CA 94043
Voice: 415-960-1300
FTP: ftp://ftp.sun.com/
WWW: http://www.sun.com/

There are also many available UNIX-based tools for reading, writing, and converting Sun Icon files. See the pbmplus package on the CD-ROM.



Copyright © 1996, 1994 O'Reilly & Associates, Inc. All Rights Reserved.