IO_IMAGE is an image processing and computer vision library written entirely in C++17. Its key feature is having zero dependencies on third-party imaging libraries (like libpng or OpenCV) for PNG file handling. It implements its own PNG reader and writer from scratch, along with a collection of computer vision algorithms.
This project aims to provide a deep understanding of the low-level mechanics of image processing, from file format management to the implementation of fundamental algorithms.
The IO_IMAGE library offers a diverse set of tools for image manipulation.
- Read and write PNG files without external dependencies.
- Handling of critical (IHDR, IDAT, IEND) and ancillary (pHYs) chunks.
- Implementation of filter algorithms (Sub, Up, Average, Paeth) and compression/decompression via the bundled
zlib.
- Color space conversion (RGB, HSL, HSV).
- Color mode conversion (RGB to Grayscale, RGB to Binary).
- Color channel extraction (Red, Green, Blue).
- Colorization via Look-Up Table (LUT).
- Image segmentation (Thresholding and Otsu's method).
- Dominant color detection (Histogram-based and K-Means clustering).
- Blur filters (Mean blur and Gaussian blur).
- Edge detection.
- Histogram computation and plotting.
- Partial multi-threading support for performance optimization.
Before building the project, make sure you have the following tools and libraries installed on your system.
- A C++17 compliant compiler (GCC, Clang, or MinGW for Windows).
- Make (for Unix-like systems).
- Development libraries for:
zlibOpenGLGLUT
- On Debian / Ubuntu:
sudo apt-get update sudo apt-get install build-essential libz-dev libglu1-mesa-dev freeglut3-dev
- On macOS (with Homebrew):
brew install gcc zlib freeglut
- On Windows:
The easiest environment is using MinGW-w64. You can install it via MSYS2 and add the necessary packages. Ensure the MinGW
bindirectory is added to your system'sPATH.
First, clone the repository:
git clone https://github.com/IgorGreenIGM/IO_IMAGE
cd IO_IMAGEThe project can be easily built using the provided Makefile.
- Open a terminal in the project's root directory.
- Run the
makecommand to build the project:make
- The executable will be generated at
bin/output.
To clean up object files and the executable, you can use:
make clean # Removes object files (*.o)
make mrproper # Removes object files and the executableThe compile.bat and link.bat batch scripts are provided for 32-bit compilation with a MinGW-like toolchain.
- Open a Command Prompt (cmd) or PowerShell terminal in the project's root directory.
- Step 1: Compile source files
Run the
compile.batscript. It will compile the.cppsource files into object files (.o) and move them to thebin/linkdirectory.compile.bat
- Step 2: Link object files
Run the
link.batscript. It will link the object files to create the final executable.link.bat
- The executable will be generated at
bin\output.exe.
The main executable is a demo program that applies a few filters to a source image.
-
Prepare the input image: Place a PNG image named
origin.pngin the project's root directory. The program will perform its operations on this image. -
Run the executable:
- On Linux / macOS:
./bin/output
- On Windows:
.\bin\output.exe
- On Linux / macOS:
-
Check the results: The program will generate two new images in the root directory:
gray.png: A grayscale version of the original image.blurred.png: A blurred version of the original image.
The /Examples directory contains visual results showcasing the library's core features. Here is a preview of the algorithms in action.
Otsu's method segments an image into black and white by finding an optimal threshold to separate the foreground from the background.
| Original | Grayscale | Binarized Result |
|---|---|---|
![]() |
![]() |
![]() |
A grayscale image is recolored using a color palette (lut.png) from another image.
| Original | Palette (LUT) | Colorized Result |
|---|---|---|
![]() |
![]() |
![]() |
The K-Means algorithm extracts the most representative colors from the original image to create a palette, which is then used for recolorization.
| Original | Extracted Palette (KMeans) | Result |
|---|---|---|
![]() |
![]() |
![]() |
An edge detection algorithm is applied to extract shapes and objects from the image.
| Original | Edges Detected |
|---|---|
![]() |
![]() |
The two most frequent colors in the image are isolated and highlighted, while the rest of the image is converted to grayscale.
| Original | Overscreened Result |
|---|---|
![]() |
![]() |
Convert RGB/HSL color spaces values to Grayscale images
| Original | Grayscale |
|---|---|
![]() |
![]() |
- @igorgreenIGM - Idea & Initial work
This project is licensed under the MIT License. See the LICENSE file for details.














