https://github.com/tito21/sample-img-format
Simple image compressor and decoder
https://github.com/tito21/sample-img-format
image-compression image-processing image-quality
Last synced: 8 months ago
JSON representation
Simple image compressor and decoder
- Host: GitHub
- URL: https://github.com/tito21/sample-img-format
- Owner: tito21
- License: gpl-3.0
- Created: 2023-01-02T02:04:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-02T02:10:28.000Z (over 3 years ago)
- Last Synced: 2025-10-12T21:44:58.843Z (8 months ago)
- Topics: image-compression, image-processing, image-quality
- Language: C++
- Homepage:
- Size: 1.96 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Image Compressor
This is a simple implementation of a lossy image compressor. It is inspired by
JPEG. As JPEG the image is decomposed into square blocks and transformed with
a Discrete Cosine Transform (DCT) and high frequencies are discarded. The image
is transformed to YCrCb color space before compression.
It doesn't really outperforms any image saving method but my goal was to learn
about openCV and saving and loading files in C++.

## Usage
Build with `make`
To compress an image run `./img-compressor input_image_path output_image_path
-num-freq=2 -block-size=8` If the output_path ends in `.cmp` a compressed image
is saved. If it ends in `.raw` a direct uncompressed image is saved. If you run
only with one path is giving the image is decoded and displayed.
## Areas for improvement
- Add support for image sizes that are not integer multiple of the block size
- Allow for different resolutions per channel.