Reputation: 1825
In the GIF specification, here:
http://www.w3.org/Graphics/GIF/spec-gif89a.txt
I am having trouble understanding two parts of it:
It specifies for 'LZW minimum code size' that:
This byte determines the initial number of bits used for LZW codes in the image data, as described in Appendix F.
It also specifies that after the single byte for the 'LZW minimum code size', there is a block called 'Image Data', of which the actual size is unspecified, and is just called 'Data Sub-blocks'.
Sorry for all the questions. Thank you for your time.
As a side-note: Even a partial answer or an answer to any of the questions would be greatly appreciated.
Upvotes: 2
Views: 480
Reputation: 15954
GIF applies the LZW algorithm with a variable (increasing) size of codes as described in Wikipedia LZW. The 'initial number of bits' is the initial size of the codes.
This is described in the document you refer to. The list of color codes of the pixels is LZW compressed (paragraph "a" just above the part you are citing).
It is there in the file (on page 30 ;-) near the end, just search for "Variable-Length-Code LZW Compression")
The "data sub-blocks" are the actual image data in chunks of 255 (or less bytes). Maybe the
The linked lists used by the image data and the extension blocks consist of series of sub-blocks, each sub-block beginning with a byte giving the number of subsequent data bytes in the sub-block (1 to 255), the series terminated by the empty sub-block (a 0 byte). [Wikipedia GIF]
"How do I work out the size of the data sub-blocks?" See above. It is the first byte of each of the blocks.
See above.
Upvotes: 2