I can get the width and the height of .webp VP8 image (lossy) from its binary data by locating the sequence \x9d\x01\x2a. The width and the height can then be easily found (through a calculation)
Now i have a problem finding the width and the height of VP8L .webp image since there is no \x9d\x01\x2a in the binary data of the image. The method used for VP8 (lossy) images cannot be applied to VP8L images. So i took the "Specification for WebP Lossless Bitstream"from developers.google.com (https://developers.google.com/speed/webp/docs/webp_lossless_bitstream_specification)
1- Data begins with the string RIFF 2- A little endian 32 bit value 3- String WEBP 4- String VP8L 5- A little endian 32 bit value 6- 1 byte signature 0x2f
And then the first 28 bits contains the width and the height : 14 bits for the width and 14 bits for the heigts image_width = ReadBits(14); image_height = ReadBits(14) + 1;
I understood that ReadBits(n) means reading the n bits in least-significant-bit-first order. When i apply this rule i get wrong values for the width and for the height. Si i must do something wrong.
Let's take a 225pixels X 225pixels image.
The binary data starts width
52 49 46 46 6e 5d 00 00 57 45 42 50 56 50 38 4c 61 5d 00 00 2f e0 00 38 00 4d 48 88 24 c9 91 24
The 28 bits after the 0x2f signature are : \xe0 \x00 \x38 \x0
So according the to method above : 14 bits width = 00000000000111 = 7 = wrong
14 bits height = 00000001110000 = 112 = wrong
So what am i doing wrong ?