VisibleGif
Image As Data Codes
Within the XML file, within the
- Warning on manually editing the "codes" data
-
Why work with the
<data-codes> tag block? -
Precedence in generation - after
<data-packed> and before<data-rows>
Image data as codes
Technical details
Image data as codes
^ Warning on manually editing the "codes" data
The data in the
^ Why work with the <data-codes> tag block?
The
The image data is equivalent to that in the
^ Precedence in generation - after <data-packed> and before <data-rows>
If an XML file contains the three versions of the image data, the precedence when generating the GIF image file is as follows.
<data-packed> <data-codes> <data-rows>
So if
Technical details
^ Codes and Sizes
The data in a
The data in a
There are two special codes.
The first, the "clear" (CC) code, is one more than the initial code size (which in turn is one more than
In the following example "CC" is 4 and "EOI" is 5. Any code less than "CC" represents the index of a particular colour in the relevant colour table (either global or local). Any code greater than "EOI" represents a "compression table" code which in turn represents a character string as defined by the LZW compression algorithm.
<lzw-minimum-code-size>2</lzw-minimum-code-size>
<data-codes>
<code size="3" > 4</code> <code size="3" > 0</code>
<code size="3" > 6</code> <code size="3" > 7</code>
<code size="4" > 8</code> <code size="4" > 9</code>
<code size="4" >10</code> <code size="4" >11</code>
<code size="4" >12</code> <code size="4" >13</code>
<code size="4" >14</code> <code size="4" >15</code>
<code size="5" >16</code> <code size="5" >17</code>
<code size="5" >18</code> <code size="5" >19</code>
<code size="5" >20</code> <code size="5" >21</code>
<code size="5" >22</code> <code size="5" >23</code>
<code size="5" >20</code> <code size="5" > 1</code>
<code size="5" >26</code> <code size="5" >27</code>
<code size="5" >28</code> <code size="5" >26</code>
<code size="5" >13</code> <code size="5" >29</code>
<code size="6" >32</code> <code size="6" > 1</code>
<code size="6" >31</code> <code size="6" >33</code>
<code size="6" >28</code> <code size="6" >35</code>
<code size="6" >36</code> <code size="6" >30</code>
<code size="6" >12</code> <code size="6" >39</code>
<code size="6" >27</code> <code size="6" >38</code>
<code size="6" >39</code> <code size="6" >44</code>
<code size="6" >36</code> <code size="6" >24</code>
<code size="6" >14</code> <code size="6" > 5</code>
</data-codes>
|
For large images the maximum number of "compression table" codes might be exceeded. This is the maximum number of "compression table" codes that can be referenced in twelve bits. When the occurs "CC" is included once again in the series of codes. This forces processing to re-initialise and as a result all previous "compression table" codes created earlier are disgarded.
^ Checklist for efficiency
If all code values are less than "CC" then LZW compression is not being used and the GIF image is very inefficient.
The relationship between the colour table size and
<lzw-minimum-code-size> is important."CC" should be the size of the colour table. If the colour table is larger than it need be because it contains colours that are not used, the initial size is higher than it need be.
Colour code tables should be kept as small as possible and runs of the same colour should be kept as long as possible. Some image editing software handles bits and bytes better than others. If a colour table has 256 colours the minimum code size will be nine bits. In most image editor software eight bits are handled faster than nine bites.
"CC" can be included in the series of codes at any time. Some image editor software includes more occurances of "CC" than is needed for optimal performance. The code size should be "12" and a "compression code" of "4096" should be required before "CC" is needed.