Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/heshanera/iproc

A dynamic library for image processing. To Extract the pixel map of the image. Support PNG, JPG, TIF and BMP image file formats. Inbuilt methods for resizing, cropping, generating grayscale and binary images.
https://github.com/heshanera/iproc

bitmap dynamic-library image-processing jpeg libjpeg libpng libtiff pixel-map png tif

Last synced: 9 days ago
JSON representation

A dynamic library for image processing. To Extract the pixel map of the image. Support PNG, JPG, TIF and BMP image file formats. Inbuilt methods for resizing, cropping, generating grayscale and binary images.

Awesome Lists containing this project

README

        

# IProc

[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/mit-license.php)   
[![language](https://img.shields.io/badge/language-c%2B%2B-red.svg)](https://github.com/heshanera/IProc)   
[![library](https://img.shields.io/badge/library-libpng-brightgreen.svg)](http://www.libpng.org/pub/png/libpng.html)   
[![library](https://img.shields.io/badge/library-libjpeg-brightgreen.svg)](http://libjpeg.sourceforge.net/)   
[![library](https://img.shields.io/badge/library-libtiff-brightgreen.svg)](http://www.libtiff.org/)   

A dynamic library for image processing. To Extract the pixel map of the image. Support PNG, JPG, TIF and BMP image file formats. Inbuilt methods for resizing, cropping, generating grayscale and binary images.

### Data Structures
`RGBAPixel`
`ImageDataStruct`
```cpp
struct RGBApixel {
unsigned char r = 0;
unsigned char g = 0;
unsigned char b = 0;
unsigned char a = 0;
};
```
```cpp
struct ImageDataStruct {
RGBApixel * imgPixArray;
int imgWidth;
int imgHeight;
};
```

### Methods
`int readImage(std::string);`

`int writeImage(std::string);`

`RGBApixel getPixel(int,int);`

`ImageDataStruct getImageDataStruct();`

`int setPixel(int,int,RGBApixel);`

`int setImageDataStruct(ImageDataStruct);`

`int resizeImage(int, int);`

`int crop(int, int, int, int);`

`int binary(int);`

`int grayscale();`

*reading the image file*
```cpp
IProc ip;
ip.readImage("path/to/source/file.jpg");
```
*getting the pixel value*
```cpp
// pixel in the position (x, y)
RGBApixel pix = ip.getPixel(10,10);
```
*set a pixel value*
```cpp
// set the pixel at position (x, y)
RGBApixel pix;
pix.r = 100;
pix.g = 100;
pix.b = 100;
pix.a = 255;
ip.setPixel(10,15,pix);
```
*get the pixel map of the image*
```cpp
ImageDataStruct imgData;
imgData = ip.getImageDataStruct();
// printing the height and width of the image
std::cout<<"Image height: "<
#include

int main() {

IProc ip;
ip.readImage("imgs/JPEG/input/img5.jpg");

int x = 10, y = 10;
RGBApixel pixel = ip.getPixel(x, y);
std::cout <<"Image("<> Image(10,10) = RGBA( 255 255 255 255 )
>> image height: 250
>> image width: 250
```
| **Original** | **Grayscale** | **Binary** | **Resized** |
| ----- |-----|-----|-----|
|![architecture](https://github.com/heshanera/IProc/blob/master/IProc%20Demo/imgs/JPEG/input/img5.jpg) |![architecture](https://github.com/heshanera/IProc/blob/master/IProc%20Demo/imgs/PNG/output/img2.png) |![architecture](https://github.com/heshanera/IProc/blob/master/IProc%20Demo/imgs/PNG/output/img3.png) |![architecture](https://github.com/heshanera/IProc/blob/master/IProc%20Demo/imgs/PNG/output/img4.png) |