tacodrake95 | Image Compressioni have had an idea for image compression in QB but am unable to put it into code right now, so i will just write our how it works and try to code it as much as possible. If someone could use this that would be cool, but if not it's alright. the format of the original bitmap (try to guess what it is) would go as follows:
20
20
15,15,15,15,15,15,15,15,00,00,00,00,15,15,15,15,15,15,15,15
15,15,15,15,15,00,00,00,15,15,15,15,00,00,00,15,15,15,15,15
15,15,15,15,00,15,15,15,15,15,15,15,15,15,15,00,15,15,15,15
15,15,15,00,15,15,15,15,15,15,15,15,15,15,15,15,00,15,15,15
15,15,00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,00,15,15
15,00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,00,15
15,00,15,15,15,15,00,15,15,15,15,15,15,00,15,15,15,15,00,15
15,00,15,15,15,00,15,00,15,15,15,15,00,15,00,15,15,15,00,15
00,15,15,15,15,15,00,15,15,15,15,15,15,00,15,15,15,15,15,00
00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,00
00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,00
00,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,00
15,00,15,15,00,15,15,15,15,15,15,15,15,15,15,00,15,15,00,15
15,00,15,15,15,00,15,15,15,15,15,15,15,15,00,15,15,15,00,15
15,00,15,15,15,15,00,00,15,15,15,15,00,00,15,15,15,15,00,15
15,15,00,15,15,15,15,15,00,00,00,00,15,15,15,15,15,00,15,15
15,15,15,00,15,15,15,15,15,15,15,15,15,15,15,15,00,15,15,15
15,15,15,15,00,15,15,15,15,15,15,15,15,15,15,00,15,15,15,15
15,15,15,15,15,00,00,00,15,15,15,15,00,00,00,15,15,15,15,15
15,15,15,15,15,15,15,15,00,00,00,00,15,15,15,15,15,15,15,15
So the format is
XSize
YSize
Data
the way it is compressed is by finding blocks of data that are the same and indexing tem so the first line would change from:
15,15,15,15,15,15,15,15,00,00,00,00,15,15,15,15,15,15,15,15
to
15x8,0x4,15x8
This line has been compressed by a factor of 20%. Not all files will have this large of blocks that are the same, so the compression ratio will vary depending on the file.
the format for the new data block goes as follows:
1)Any pixel that has ONE in a row is left as is
2)Any line of pixels is displayed as COLORxNUMPIX with x as the seperator. | 2011-09-16 | 12:23 PM |