This library aims to provide its users with basic image processing operations along with ways to compress the images. Currently the following operations are supported:
- RGB to Grayscale
- Horizontal and Vertical Flip
Support for more operations are welcome!
Image compression is done using the k-means algorithm, pixel values are grouped together to form bands of pixels, hence making it more compressable for JPEG and other methods of compression.
Note: You need to have GCC version > 10.2.0
- Clone the repo with
git clone https://github.com/DebadityaPal/k-means-compressor
- Run the software with CLI commands The CLI commands are:
g++ compressor.cpp -o compressor
compressor <args>
The arguments are listed below
Usage:
Image Compression(-c):
-i: Path to the input image
-o: Path to the output image
-cl: (Optional, default: 64) Number of clusters used for compression
-n: (Optional) Normalize the image before compression
-it: (Optional, default: 5) Number of epochs for k-means compression
Batch Compression (-b):
-i: Path to the input directory
-o: Path to the output directory
-f: Format for output images
-cl: (Optional, default: 64) Number of clusters used for compression
-it: (Optional, default: 5) Number of epochs for k-means compression
Seam Carving (-s):
-i: Path to the input image
-o: Path to the output image
-p: (Optional, default: 1) Percentage of width to be retained
Image editing (-e):
-g: Convert to grayscale
-h: Flip the image horizontally
-v: Flip the image vertically
-i: Path to the input image
-o: Path to the output image