Image compression with K-means clustering.
K-Compress compresses 24-bit uncompressed BMP 4.0 files using K-means clustering. The compressed images take up only about 33% of the initial space! (For smaller images, the effects may be less profound.)
- Compile
compress.c
. Eg.gcc compress.c -o compress.exe
- Compile
decompress.c
. Eg.gcc decompress.c -o decompress.exe
- To compress an image, run the compiled
compress.c
file, passing in the path to the input image and the path to the compressed output. Eg../compress.exe path/to/image compressed.out
. - To decompress an image, run the compiled
decompress.exe
file, passing in the path to the compressed image and a path for the decompressed output. Eg../decompress.exe compressed.out decompressed.bmp
.
bmp.h
was taken from CS50's Introduction to Computer Science.