<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.evillabs.net/index.php?action=history&amp;feed=atom&amp;title=Amiga_Icon_Formats</id>
	<title>Amiga Icon Formats - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://www.evillabs.net/index.php?action=history&amp;feed=atom&amp;title=Amiga_Icon_Formats"/>
	<link rel="alternate" type="text/html" href="http://www.evillabs.net/index.php?title=Amiga_Icon_Formats&amp;action=history"/>
	<updated>2026-05-05T17:55:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>http://www.evillabs.net/index.php?title=Amiga_Icon_Formats&amp;diff=513&amp;oldid=prev</id>
		<title>Ezrec: Created page with &quot; &lt;nowiki&gt; Dirk St�cker &lt;stoecker@epost.de&gt; 17th February 2002  Format description of Amiga Icon Format.  This format is used by Amiga computers to display icons for each progra...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.evillabs.net/index.php?title=Amiga_Icon_Formats&amp;diff=513&amp;oldid=prev"/>
		<updated>2011-11-06T16:27:03Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; &amp;lt;nowiki&amp;gt; Dirk St�cker &amp;lt;stoecker@epost.de&amp;gt; 17th February 2002  Format description of Amiga Icon Format.  This format is used by Amiga computers to display icons for each progra...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
Dirk St�cker &amp;lt;stoecker@epost.de&amp;gt;&lt;br /&gt;
17th February 2002&lt;br /&gt;
&lt;br /&gt;
Format description of Amiga Icon Format.&lt;br /&gt;
&lt;br /&gt;
This format is used by Amiga computers to display icons for each program&lt;br /&gt;
or project you want to access from the graphical user interface Workbench.&lt;br /&gt;
&lt;br /&gt;
There are 3 different formats.&lt;br /&gt;
1) The OS1.x/OS2.x icons.&lt;br /&gt;
2) The NewIcon icon extension.&lt;br /&gt;
3) The OS3.5 icon extension.&lt;br /&gt;
&lt;br /&gt;
A note about the used data descriptors. All elements are in Motorola byte&lt;br /&gt;
order (highest byte first):&lt;br /&gt;
APTR  - a memory pointer (usually this gets a boolean meaning on disk)&lt;br /&gt;
BYTE  - a single byte                   -128..127&lt;br /&gt;
UBYTE - an unsigned byte                   0..255&lt;br /&gt;
WORD  - a signed 16 bit value         -32768..32767&lt;br /&gt;
UWORD - an unsigned 16 bit value           0..65535&lt;br /&gt;
LONG  - a signed 32 bit value    -2147483648..2147483647&lt;br /&gt;
ULONG - a unsigned 32 bit value            0..4294967295&lt;br /&gt;
There are lots of elements marked with ???. These are usually filled with&lt;br /&gt;
values, which have no effect at all. Thus they can normally be ignored.&lt;br /&gt;
For some values the usual contents is described.&lt;br /&gt;
&lt;br /&gt;
******************************&lt;br /&gt;
***** OS1.x/OS2.x format *****&lt;br /&gt;
******************************&lt;br /&gt;
The OS1.x/OS2.x format is mainly an storage of the in-memory structures on&lt;br /&gt;
disk. This means there is many crap in that format, which may have undefined&lt;br /&gt;
values. This text tries to show which values are important and which not.&lt;br /&gt;
&lt;br /&gt;
0x00 UWORD ic_Magic          always 0xE310&lt;br /&gt;
0x00 UWORD ic_Version        always 1&lt;br /&gt;
0x04 struct Gadget           (described below)&lt;br /&gt;
0x30 UBYTE ic_Type&lt;br /&gt;
     1 DISK                  a disk&lt;br /&gt;
     2 DRAWER                a directory&lt;br /&gt;
     3 TOOL                  a program&lt;br /&gt;
     4 PROJECT               a project file with defined program to start&lt;br /&gt;
     5 GARBAGE               the trashcan&lt;br /&gt;
     6 DEVICE                should never appear&lt;br /&gt;
     7 KICK                  a kickstart disk&lt;br /&gt;
     8 APPICON               should never appear&lt;br /&gt;
0x31 UBYTE ic_Pad            &amp;lt;undefined&amp;gt;&lt;br /&gt;
0x32 APTR  ic_DefaultTool    &amp;lt;boolean&amp;gt;&lt;br /&gt;
0x36 APTR  ic_ToolTypes      &amp;lt;boolean&amp;gt;&lt;br /&gt;
0x3A LONG  ic_CurrentX       X position of icon in drawer/on WorkBench&lt;br /&gt;
0x3E LONG  ic_CurrentY       Y position of icon in drawer/on WorkBench&lt;br /&gt;
0x42 APTR  ic_DrawerData     &amp;lt;boolean&amp;gt;&lt;br /&gt;
0x46 APTR  ic_ToolWindow     &amp;lt;boolean&amp;gt;&lt;br /&gt;
0x4A LONG  ic_StackSize      the stack size for program execution&lt;br /&gt;
                             (values &amp;lt; 4096 mean 4096 is used)&lt;br /&gt;
This is followed by certain other data structures:&lt;br /&gt;
struct DrawerData            if ic_DrawerData is not zero (see below)&lt;br /&gt;
struct Image                 first image&lt;br /&gt;
struct Image                 second image if ga_SelectRender not zero&lt;br /&gt;
                             (see below) in gadget structure&lt;br /&gt;
DefaultTool text             if ic_DefaultTool not zero (format see below)&lt;br /&gt;
ToolTypes texts              if ic_ToolTypes not zero (format see below)&lt;br /&gt;
ToolWindow text              if ic_ToolWindow not zero (format see below)&lt;br /&gt;
                             this is an extension, which was never implemented&lt;br /&gt;
struct DrawerData2           if ic_DrawerData is not zero and ga_UserData&lt;br /&gt;
                             is 1 (see below)&lt;br /&gt;
&lt;br /&gt;
Now a description of the sub-formats:&lt;br /&gt;
&lt;br /&gt;
a) The text storage method (DefaultTool, ToolWindow and ToolTypes):&lt;br /&gt;
0x00 ULONG tx_Size           the size of tx_Text including zero byte (tx_Zero)&lt;br /&gt;
0x04 ...   tx_Text           the plain text&lt;br /&gt;
.... UBYTE tx_Zero           the finishing zero byte&lt;br /&gt;
This means the text &amp;quot;Hallo&amp;quot; will be encoded as \00\00\00\06Hallo\00.&lt;br /&gt;
&lt;br /&gt;
As ToolTypes are an array of texts the encoding is preceeded by another&lt;br /&gt;
ULONG value containing the number of entries. But to make parsing more&lt;br /&gt;
interessting it is not the number as one would expect, but the number of&lt;br /&gt;
entries increased by one and multiplied by 4. Thus 10 entries will have&lt;br /&gt;
44 as count.&lt;br /&gt;
&lt;br /&gt;
b) The Gadget structure:&lt;br /&gt;
0x00 APTR  ga_Next           &amp;lt;undefined&amp;gt; always 0&lt;br /&gt;
0x04 WORD  ga_LeftEdge       unused ???&lt;br /&gt;
0x06 WORD  ga_TopEdge        unused ???&lt;br /&gt;
0x08 WORD  ga_Width          the width of the gadget&lt;br /&gt;
0x0A WORD  ga_Height         the height of the gadget&lt;br /&gt;
0x0C UWORD ga_Flags          gadget flags&lt;br /&gt;
     bit 2                   always set (image 1 is an image ;-)&lt;br /&gt;
     bit 1                   if set, we use 2 image-mode&lt;br /&gt;
     bit 0                   if set we use backfill mode, else complement mode&lt;br /&gt;
                             complement mode: gadget colors are inverted&lt;br /&gt;
                             backfill mode: like complement, but region&lt;br /&gt;
                             outside (color 0) of image is not inverted&lt;br /&gt;
     As you see, it makes no sense having bit 0 and 1 set.&lt;br /&gt;
0x0E UWORD ga_Activation     &amp;lt;undefined&amp;gt;&lt;br /&gt;
0x10 UWORD ga_GadgetType     &amp;lt;undefined&amp;gt;&lt;br /&gt;
0x12 APTR  ga_GadgetRender   &amp;lt;boolean&amp;gt; unused??? always true&lt;br /&gt;
0x16 APTR  ga_SelectRender   &amp;lt;boolean&amp;gt; (true if second image present)&lt;br /&gt;
0x1A APTR  ga_GadgetText     &amp;lt;undefined&amp;gt; always 0 ???&lt;br /&gt;
0x1E LONG  ga_MutualExclude  &amp;lt;undefined&amp;gt;&lt;br /&gt;
0x22 APTR  ga_SpecialInfo    &amp;lt;undefined&amp;gt;&lt;br /&gt;
0x26 UWORD ga_GadgetID       &amp;lt;undefined&amp;gt;&lt;br /&gt;
0x28 APTR  ga_UserData       lower 8 bits:  0 for old, 1 for icons &amp;gt;= OS2.x&lt;br /&gt;
			     upper 24 bits: undefined&lt;br /&gt;
&lt;br /&gt;
c) The DrawerData structure:&lt;br /&gt;
This structure is useful for drawers and disks (but there are some&lt;br /&gt;
icons of other types, which still have these obsolete entries).&lt;br /&gt;
0x00 struct NewWindow        (see below)&lt;br /&gt;
0x30 LONG  dd_CurrentX       the current X position of the drawer window&lt;br /&gt;
                             contents (this is the relative offset of the&lt;br /&gt;
                             drawer drawmap)&lt;br /&gt;
0x34 LONG  dd_CurrentY       the current Y position of the drawer window&lt;br /&gt;
                             contents&lt;br /&gt;
&lt;br /&gt;
d) The NewWindow structure used by DrawerData:&lt;br /&gt;
0x00 WORD  nw_LeftEdge       left edge distance of window&lt;br /&gt;
0x02 WORD  nw_TopEdge        top edge distance of widndow&lt;br /&gt;
0x04 WORD  nw_Width          the width of the window (outer width)&lt;br /&gt;
0x06 WORD  nw_Height         the height of the window (outer height)&lt;br /&gt;
0x08 UBYTE nw_DetailPen      always 255 ???&lt;br /&gt;
0x09 UBYTE nw_BlockPen       always 255 ???&lt;br /&gt;
0x0A ULONG nw_IDCMPFlags     &amp;lt;undefined&amp;gt;&lt;br /&gt;
0x0E ULONG nw_Flags          &amp;lt;undefined&amp;gt;&lt;br /&gt;
0x12 APTR  nw_FirstGadget    &amp;lt;undefined&amp;gt;&lt;br /&gt;
0x16 APTR  nw_CheckMark      &amp;lt;undefined&amp;gt;&lt;br /&gt;
0x1A APTR  nw_Title          &amp;lt;undefined&amp;gt;&lt;br /&gt;
0x1E APTR  nw_Screen         &amp;lt;undefined&amp;gt;&lt;br /&gt;
0x22 APTR  nw_BitMap         &amp;lt;undefined&amp;gt;&lt;br /&gt;
0x26 WORD  nw_MinWidth       &amp;lt;undefined&amp;gt; often 94, minimum window width&lt;br /&gt;
0x28 WORD  nw_MinHeight      &amp;lt;undefined&amp;gt; often 65, minimum window height&lt;br /&gt;
0x2A UWORD nw_MaxWidth       &amp;lt;undefined&amp;gt; often 0xFFFF, maximum window width&lt;br /&gt;
0x2C UWORD nw_MaxHeight      &amp;lt;undefined&amp;gt; often 0xFFFF, maximum window width&lt;br /&gt;
0x2E UWORD nw_Type           &amp;lt;undefined&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e) The DrawerData2 structure for OS2.x drawers:&lt;br /&gt;
0x00 ULONG dd_Flags          flags for drawer display&lt;br /&gt;
     value 0                 handle viewmode like parent drawer current&lt;br /&gt;
                             setting (OS1.x compatibility mode)&lt;br /&gt;
     bit 0                   view icons&lt;br /&gt;
     bit 1                   view all files (bit 0 maybe set or unset&lt;br /&gt;
                             with this)&lt;br /&gt;
0x04 UWORD dd_ViewModes      viewmodes of drawer display&lt;br /&gt;
     value 0                 show icons (OS1.x compatibility mode)&lt;br /&gt;
     value 1                 show icons&lt;br /&gt;
     value 2                 show sorted by name&lt;br /&gt;
     value 3                 show sorted by date&lt;br /&gt;
     value 4                 show sorted by size&lt;br /&gt;
     value 5                 show sorted by type&lt;br /&gt;
&lt;br /&gt;
f) And now the last element, the Image structure:&lt;br /&gt;
0x00 WORD  im_LeftEdge       always 0 ???&lt;br /&gt;
0x00 WORD  im_TopEdge        always 0 ???&lt;br /&gt;
0x04 WORD  im_Width          the width of the image&lt;br /&gt;
0x06 WORD  im_Height         the height of the image&lt;br /&gt;
0x08 WORD  im_Depth          the image bitmap depth&lt;br /&gt;
0x0A APTR  im_ImageData      &amp;lt;boolean&amp;gt; always true ???&lt;br /&gt;
0x0E UBYTE im_PlanePick      foreground color register index&lt;br /&gt;
0x0F UBYTE im_PlaneOnOff     background color register index&lt;br /&gt;
0x10 APTR  im_Next           always 0 ???&lt;br /&gt;
This is followed by the image data in planar mode. The width of the&lt;br /&gt;
image is always rounded to next 16bit boundary.&lt;br /&gt;
&lt;br /&gt;
******************************&lt;br /&gt;
***** NewIcon extension ******&lt;br /&gt;
******************************&lt;br /&gt;
&lt;br /&gt;
As the original format is very limited when using more than the 4 or 8 default&lt;br /&gt;
colors and also when using different palette sets than the default, there have&lt;br /&gt;
been ideas how to circumvent this. A Shareware author invented NewIcons&lt;br /&gt;
format, which uses the ToolTypes to store image data, as expanding the original&lt;br /&gt;
format very surely would haven broken compatibility.&lt;br /&gt;
&lt;br /&gt;
The NewIcons stuff usually starts with following 2 ToolTypes text (text inside&lt;br /&gt;
of the &amp;quot;&amp;quot; only):&lt;br /&gt;
&amp;quot; &amp;quot;&lt;br /&gt;
&amp;quot;*** DON&amp;#039;T EDIT THE FOLLOWING LINES!! ***&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Aftwerwards the image data is encoded as ASCII. The lines for first image&lt;br /&gt;
always start with &amp;quot;IM1=&amp;quot;. If present the second image starts with &amp;quot;IM2=&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The first line of each image set contains the image information and the&lt;br /&gt;
palette.&lt;br /&gt;
Example: &amp;quot;IM1=B}}!&amp;#039;��5(3%;ll����T�S9`�&amp;quot;&lt;br /&gt;
&lt;br /&gt;
0x00 UBYTE ni_Transparency&lt;br /&gt;
     &amp;quot;B&amp;quot;                     transparency on&lt;br /&gt;
     &amp;quot;C&amp;quot;                     transparency off&lt;br /&gt;
0x01 UBYTE ni_Width          image width + 0x21  - &amp;quot;}&amp;quot; means width 92&lt;br /&gt;
0x02 UBYTE ni_Height         image height + 0x21 - &amp;quot;}&amp;quot; means height 92&lt;br /&gt;
0x03 UWORD ni_Colors         ASCII coded number of palette entries:&lt;br /&gt;
     entries are: ((buf[3]-0x21)&amp;lt;&amp;lt;6)+(buf[4]-0x21)&lt;br /&gt;
     &amp;quot;!&amp;#039;&amp;quot; means 6 entries&lt;br /&gt;
Afterwards the encoded palette is stored. Each element has 8 bit and colors&lt;br /&gt;
are stored in order red, green, blue. The encoded format is described below.&lt;br /&gt;
The ni_Width and ni_Height maximum values are 93. The maximum color value&lt;br /&gt;
is theoretically 255. I have seen images with at least 257 stored colors&lt;br /&gt;
(but less than 256 used).&lt;br /&gt;
&lt;br /&gt;
The following lines contain the image data encoded with the same system as&lt;br /&gt;
the palette. The number of bits used to encode an entry depends of the number&lt;br /&gt;
of colors (6 colors f.e. need 3 bit). The lines have maximum 127 bytes&lt;br /&gt;
including the &amp;quot;IM1=&amp;quot; or &amp;quot;IM2=&amp;quot; header. Thus including the zero byte, the&lt;br /&gt;
string will be 128 byte.&lt;br /&gt;
&lt;br /&gt;
En/Decoding algorithm:&lt;br /&gt;
Each byte encodes 7bit (except the RLE bytes)&lt;br /&gt;
Bytes 0x20 to 0x6F represent 7bit value 0x00 to 0x4F&lt;br /&gt;
Bytes 0xA1 to 0xD0 represent 7bit value 0x50 to 0x7F&lt;br /&gt;
Bytes 0xD1 to 0xFF are RLE bytes:&lt;br /&gt;
  0xD1 represents  1*7 zero bits,&lt;br /&gt;
  0xD2 represents  2*7 zero bits and the last value&lt;br /&gt;
  0xFF represents 47*7 zero bits.&lt;br /&gt;
&lt;br /&gt;
Opposite to the original icon format, the NewIcons format uses chunky modus&lt;br /&gt;
to store the image data.&lt;br /&gt;
&lt;br /&gt;
The encoding for images and palette stops at the string boundary (127 bytes)&lt;br /&gt;
with buffer flush (and adding pad bits) and is restarted with next line.&lt;br /&gt;
&lt;br /&gt;
******************************&lt;br /&gt;
****** OS3.5 extension *******&lt;br /&gt;
******************************&lt;br /&gt;
&lt;br /&gt;
The OS3.5 format introduces nearly the same information as in NewIcons, but&lt;br /&gt;
in a more usable format. The tooltypes are no longer misused, but a new data&lt;br /&gt;
block is appended at the end of the icon file. This data block is in IFF&lt;br /&gt;
format.&lt;br /&gt;
It consists of the standard header&lt;br /&gt;
0x00 UBYTE[4] ic_Header      set to &amp;quot;FORM&amp;quot;&lt;br /&gt;
0x04 ULONG    ic_Size        size [excluding the first 8 bytes!]&lt;br /&gt;
0x08 UBYTE[4] ic_Identifier  set to &amp;quot;ICON&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Now Chunks of different data follow. Each chunk consists of 8 header bytes&lt;br /&gt;
and the data bytes. If the size in header is uneven, then it is automatically&lt;br /&gt;
paddind with 1 byte at the end.&lt;br /&gt;
&lt;br /&gt;
Currently 3 chunks are used with following data. Note that IFF generally&lt;br /&gt;
allows expansion and chunk reordering, so do not rely on any current size&lt;br /&gt;
information or chunk order, but skip unknown data based on the size&lt;br /&gt;
information stored in file.&lt;br /&gt;
&lt;br /&gt;
1)&lt;br /&gt;
0x00 UBYTE[4] fc_Header      set to &amp;quot;FACE&amp;quot;&lt;br /&gt;
0x04 ULONG    fc_Size        size [excluding the first 8 bytes!]&lt;br /&gt;
0x08 UBYTE    fc_Width       icon width subtracted by 1&lt;br /&gt;
0x09 UBYTE    fc_Height      icon height subtracted by 1&lt;br /&gt;
0x0A UBYTE    fc_Flags       flags&lt;br /&gt;
     bit 0                   icon is frameless&lt;br /&gt;
0x0B UBYTE    fc_Aspect      image aspect ratio:&lt;br /&gt;
     upper 4 bits            x aspect&lt;br /&gt;
     lower 4 bits            y aspect&lt;br /&gt;
0x0C UWORD    fc_MaxPalBytes maximum number of bytes used in image palettes&lt;br /&gt;
                             subtracted by 1 (i.e. if palette 1 has 17 and&lt;br /&gt;
                             palette 2 has 45 entries, then this is 45)&lt;br /&gt;
&lt;br /&gt;
2) Now 2 chunks of this type may come, where first chunk is image 1&lt;br /&gt;
and second chunk is image 2.&lt;br /&gt;
0x00 UBYTE[4] im_Header      set to &amp;quot;IMAG&amp;quot;&lt;br /&gt;
0x04 ULONG    im_Size        size [excluding the first 8 bytes!]&lt;br /&gt;
0x08 UBYTE    im_Transparent number of the transparent color&lt;br /&gt;
0x09 UBYTE    im_NumColors   number of colors subtracted by 1&lt;br /&gt;
0x0A UBYTE    im_Flags&lt;br /&gt;
     bit 0                   there exists a transparent color&lt;br /&gt;
     bit 1                   a palette data is attached (NOTE, that first&lt;br /&gt;
                             image always needs palette data, whereas the&lt;br /&gt;
                             second one can reuse the first palette.)&lt;br /&gt;
0x0B UBYTE    im_ImageFormat storage format of image data&lt;br /&gt;
     value 0                 uncompressed&lt;br /&gt;
     value 1                 run-length compressed&lt;br /&gt;
0x0C UBYTE    im_PalFormat   storage format of palette data (same as above)&lt;br /&gt;
0x0D UBYTE    im_Depth       the number of bits used to store a pixel&lt;br /&gt;
0x0E UWORD    im_ImageSize   number of bytes used to store image (subtracted&lt;br /&gt;
                             by 1)&lt;br /&gt;
0x10 UWORD    im_PalSize     number of bytes used to store palette&lt;br /&gt;
                             (subtracted by 1)&lt;br /&gt;
0x12 UBYTE[...]              the image data&lt;br /&gt;
.... UBYTE[...]              the palette data (if existing)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now about the run-length compression. This is equal to the run-length method&lt;br /&gt;
in IFF-ILBM format: The input data is seen as a bit-stream, where each entry&lt;br /&gt;
has im_Depth bits for image or 8 bits for palette. First comes an 8 bit RLE&lt;br /&gt;
block with following meaning:&lt;br /&gt;
0x00 .. 0x7F copy the next n entries as they are, where n is &amp;quot;RLE-value&amp;quot;+1&lt;br /&gt;
0x80         ignore this, do nothing&lt;br /&gt;
0x81 .. 0xFF produce the next entry n times, where n is 256-&amp;quot;RLE-value&amp;quot;+1&lt;br /&gt;
             (if using signed chars n is &amp;quot;RLE-value&amp;quot;+1)&lt;br /&gt;
&lt;br /&gt;
In uncompressed mode, each byte represents one pixel (even if lower depth is&lt;br /&gt;
used).&lt;br /&gt;
&lt;br /&gt;
********************************&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ezrec</name></author>
	</entry>
</feed>