First week programming III
|
On the first day of the course we were faced with a challenge; compress and decompress an image file. This were to be programmed work with other images as well so nothing could be hard coded. There are different approaches to this task such as checking the bitmap for color patterns but after the task we also learned about the method of calculating the colors as geometrical figures. The team consisting myself, David Peldan and Oliver Bolt began on the the first idea where we checked for how long a color occurred in a pixel-row by row reading of the file. But even before the actual coding began I thoroughly searched the image only to find that among the white area there was also a small grey box. So step one of our compression was to first get the program to identify the various colors in the image. When finding them there was the order of actually compress them and converting the value into a read-able but small format, we came as small as to something which the group believed to be raw bit data, it was hard to understand but you could see where the data changed because of the color change but we however could not get the values in a correct order. This was later on explained at the end of the task where the tutor explained that bmp-files does not get read as regular files (top-left to lower right corner) The group made it so far as to compress the file to the size of 4kb however that build went corrupt after some alternations in code, the stable version we had left gave us a file of 7kb. Even though it was a tad bigger than the 4kb one the group were happy with this result. Now for decompressing the image the group faced a whole another problem, for some reason the program used more memory than the heap allowed it to, the team fiddled with it for a long while but time eventually ran out but at least we ended up with a pretty small file size. |