Skip to content

Harmos274/ImageCompressor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Compressor

K-mean algorithm applied to image compression.

Build

Stack and GNU Make are used to build the project.

Makefile

$> git clone https://github.com/Harmos274/ImageCompressor
$> cd ImageCompressor
$> make

How to use it ?

$> ./imageCompressor -h
USAGE: ./imageCompressor n e input

	n		number of colors in the final image
	e		convergence limit
	input	path of the file containing the colors of the pixels

Input Format

$> head exampleInput
(0,0) (33,18,109)
(0,1) (33,18,109)
(0,2) (33,21,109)
(0,3) (33,21,112)
(0,4) (33,25,112)
(0,5) (33,32,112)
(1,0) (33,18,109)
(1,1) (35,18,109)
(1,2) (35,21,109)
(1,3) (38,21,112)

The left column is the actual position of a pixel and the right column it's color.

Tests (With Tasty and HUnit)

$> stack test

Note:

I could rework the project for fun to allow bmp format. Not certainly, but i could do it.