Specifically, I would like a better definition of building the bit
blocks after the LZW code size character. I know the LZW code size
character defines how long each bits length is, and the next character
is the block size (how many characters). I also know the bits are
placed right to left, but I am having trouble understanding how the
bits should be placed correctly. The test image I am creating is a 2
pixel by 2 pixel image with a checkered pattern of black/white. A
graphics program ends up with the 3 bytes being 12, 16 and 5. I
assume the 5 is the end of the data block (bit size*2)+1, but don't
understand the arrangement of the 12, 16 bits in binary (00001100 and
00010000). I have the test image (2 pixel by 2 pixel) online at:
http://goldborder.com/test.gif
Thank you for your help. |
Request for Question Clarification by
googlebrain-ga
on
02 Jul 2002 15:40 PDT
Your test image doesn't seem to have a header. "GIF89a" should be the
first 6 characters of any gif file. Did you create the file with your
own software, or did you use some other program?
|
Clarification of Question by
thinkingskull-ga
on
02 Jul 2002 15:44 PDT
I may have changed the header with my new program. I have resaved
through Photoshop and resent to the server.
Please try the image: http://goldborder.com/test.gif
dave
|
Request for Question Clarification by
googlebrain-ga
on
02 Jul 2002 16:24 PDT
Are you aware that you image isn't a checkerboard? This is what it
looks like.
*0
00
Where * is a Black square, and 0 is a White square.
I will continue to investigate your problem, but perhaps this is what
has been causing your confusion?
Anyway, how do you wish to procede?
|
Request for Question Clarification by
googlebrain-ga
on
02 Jul 2002 16:58 PDT
"0C 10"
The first byte is 0x0c (12) 00001100
the second byte is 0x10 (16) 00010000
together they read like this
0001000000001100
reading Right to left.
the first three bits (100) represent a "Clear Code" 2**<code size> or
100
The next three bits 001
The next three bits 000
The next three bits 000
The next three bits 001
These would seem to represent (progressing Left to right, and Top to
Bottom)
-------------
! 001 ! 000 !
-------------
! 000 ! 001 !
-------------
Which looks awfully like the grid you were trying for.
However, that would only be the case if there were no LZW compression
being applied to your data. Are you, in fact, doing the compression,
or just storing the bits raw?
|
Request for Question Clarification by
googlebrain-ga
on
02 Jul 2002 17:26 PDT
Alright, this is getting weird. Originally, I used Paint Shop Pro to
view your image, and it showed the broken version of the graphic (*0,
00) but all of the Microsoft viewers I use (Internet Explorer, and
Paint) show the grid the way I assume you ment for it to be. (*0, 0*)
Anyway, there's obviously something hinky going on here. I'd bet it
has to do with the compression/non-compression of those bits I
mentioned before.
|
Clarification of Question by
thinkingskull-ga
on
02 Jul 2002 17:33 PDT
I looked at the image and it is:
0X
X0 (0 = black, X = white)
Img Location: http://goldborder.com/test.gif
I pulled it up for a co-worker and he also saw the checkered pattern.
I then opened it up in Photoshop at 1600 percent zoom and saw the same
pattern.
I then created a byte checker program to look at the GIF byte by byte.
Here is the test.gif file byte by byte:
<table border=0 cellpadding=3 cellspacing=1>
<tr>
<td><b>CHAR</b></td>
<td><b>ASCII</b></td>
<td><b>Position</b></td>
</tr>
<tr><td>G</td><td>71</td><td>1</td></tr>
<tr><td>I</td><td>73</td><td>2</td></tr>
<tr><td>F</td><td>70</td><td>3</td></tr>
<tr><td>8</td><td>56</td><td>4</td></tr>
<tr><td>9</td><td>57</td><td>5</td></tr>
<tr><td>a</td><td>97</td><td>6</td></tr>
<tr><td></td><td>2</td><td>7</td></tr>
<tr><td> </td><td>0</td><td>8</td></tr>
<tr><td></td><td>2</td><td>9</td></tr>
<tr><td> </td><td>0</td><td>10</td></tr>
<tr><td>€</td><td>128</td><td>11</td></tr>
<tr><td> </td><td>0</td><td>12</td></tr>
<tr><td> </td><td>0</td><td>13</td></tr>
<tr><td>ÿ</td><td>255</td><td>14</td></tr>
<tr><td>ÿ</td><td>255</td><td>15</td></tr>
<tr><td>ÿ</td><td>255</td><td>16</td></tr>
<tr><td> </td><td>0</td><td>17</td></tr>
<tr><td> </td><td>0</td><td>18</td></tr>
<tr><td> </td><td>0</td><td>19</td></tr>
<tr><td>,</td><td>44</td><td>20</td></tr>
<tr><td> </td><td>0</td><td>21</td></tr>
<tr><td> </td><td>0</td><td>22</td></tr>
<tr><td> </td><td>0</td><td>23</td></tr>
<tr><td> </td><td>0</td><td>24</td></tr>
<tr><td></td><td>2</td><td>25</td></tr>
<tr><td> </td><td>0</td><td>26</td></tr>
<tr><td></td><td>2</td><td>27</td></tr>
<tr><td> </td><td>0</td><td>28</td></tr>
<tr><td> </td><td>0</td><td>29</td></tr>
<tr><td></td><td>2</td><td>30</td></tr>
<tr><td></td><td>3</td><td>31</td></tr>
<tr><td></td><td>12</td><td>32</td></tr>
<tr><td></td><td>16</td><td>33</td></tr>
<tr><td></td><td>5</td><td>34</td></tr>
<tr><td> </td><td>0</td><td>35</td></tr>
<tr><td>;</td><td>59</td><td>36</td></tr>
</table>
|
Clarification of Question by
thinkingskull-ga
on
02 Jul 2002 17:41 PDT
I was saving a new gif image in Photoshop and then playing with it. I
was leaving the LZW up to Photoshop and then backwards engineering the
file to understand how it was building the bit arrangement.
Your example of the bit count makes sense but I thought Position 30
which is ASCII 2 is stating the bit count, and Position 31 is stating
the Byte length of the Block. By your example, the bit count is 3?
Thank you in advance
|
Clarification of Question by
thinkingskull-ga
on
02 Jul 2002 17:46 PDT
The table code didn't show, so I put up a cleaner version at:
http://goldborder.com/testgif.htm
|
Request for Question Clarification by
googlebrain-ga
on
02 Jul 2002 18:22 PDT
Output codes are a minimum of <code size>+1 and a maximum of 12 bits
long. The extra bit is to allow for the clear code (100) which would
never occur naturally with a 2 bit code size. Basically, if the
highest bit is a 1, it's a special code. Otherwise, it's data.
|