Skip to content

Image compression and storing by reducing number of colors

License

Notifications You must be signed in to change notification settings

DobriniaMerk/FSD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FSD: an image compression algorithm

This is a new image storing format, which decreases the number of colors in the image to achieve an extremely low file size. With different quality settings, it gets 3-5 times smaller image files than jpg images. It was written entirely in C++, which gives reasonable processing speeds. This repository contains source for FSD file reading program and a program to convert regular images to FSD format along with an installer for them.

Realization Details

Image processing

This program uses Floyd–Steinberg's dithering algorithm to distribute colors on the picture without losing its details. The colors themselves are chosen with the k-means clustering method, which searches for big clusters of similar colors in color space and chooses their centers as new image colors.

File saving

Image is saved to disk with almost the most basic and simple algorithm possible — Run-Length encoding (surely must be changed in future). To make the resulting file smaller, it is then compressed with the zpaq file compression library.

Comparison with other formats

JPEG / PNG FSD
passage fsdpssg
Regular JPEG image with default quality setting of 90, wheighting 216 KB.
In PNG format, it weights 1013 KB.
FSD image compressed to 8 colors, weights only 75 KB.

Compiling

I havent tried compiling this project with anything other than Visual Studio, and for it, the compilation is simple. Everything needed for the project is already in the repository, so all you need is to include SDL folders in linker settings, if they are not set up already, and then compile the binaries.