Skip to content

Priax/ImageCompressor

Repository files navigation

imageCompressor

This project's goal was to make an image compressor using the "kMeans" algorithm, fully in haskell using clustering. This was made on Fedora linux using Haskell and stack to build.

Each colors of the image are grouped into "Clusters", then, based on the number of colors you want, it chooses the most prevalent colors to keep, making a compressed image.

How to compile:

make

You can test it doing this:

./ic_tools_fedora36/convertImg your_image > converted_img.txt
./imageCompressor -n NbColors -l convergenceNb (for example 0.08) -f converted_img.txt > compressed_img.txt
./ic_tools_fedora36/xpmImg compressed_img.txt > compressed.xpm

And Voilà ! You have a compressed image :D

Example with 4 colors:

Image of Rin Tezuka as a Witch
Image of Rin Tezuka as a Witch, but compressed

It was a fun project to do, a bit hard because doing this type of algorithm in Haskell is hard, but I like the result !

About

An Image Compressor I made in Haskell !

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published