You are not paying attention to what I am saying to you.
First: Asc(91) does not equal 5B. It the other way around; Asc(Chr(&H5B)) = 91. To get the hexadecimal you simply do this Hex(91) = 5B
If it is decimal 91 (which means the byte is 5B then there is no Global Color Table so it is meaningless to try and to find it's size.
Second, you do not use the last 3-bits like you are doing. Do not do this:
3 * (2 ^ ((011) + 1))=12288
because you are using the last 3-bits as the value and that is not what you should do. 011 = 3 so you math would be this:
3 * (2 ^ 3) + 1 = 25
Your VB code is this:
3 * (2 ^ (Asc(Mid(GifBuffer, 11, 1)) And 3)) + 1
But remember, &H5B says there is no global color table which means that the frame(s) have their own so the above calculation would be meaningless in this case but you would use this when there is a global color table or use it for a local color table except the offset 11 would be a different number
3 * (2 ^ (Asc(Mid(GifBuffer, ??, 1)) And 3)) + 1
where ?? is the string position for the byte that is used for a local color table
To extract the values from this byte use the following
7654 3210
xxxx xxxx
And 128 to get x000 0000 = Global Color Table Flag
And 48 to get 0xxx 0000 = Color Resolution
And 8 to get 0000 x000 = Sort Flag
And 3 to get 0000 0xxx = Global Color Table Size




Reply With Quote