0.0.1 • Published 3 years ago
@zerasul/image-read-helper v0.0.1
Image Read Helper
This library allows you to get some information about images; reading and getting information like width, height and the palette colour.
Instalation
To install this library, use npm install
.
npm install image-reader-helper
This library is created with TypeScript and compiled for ES6. Here is an example of use:
You can read a file using his path.
import {ImageReader,ImageModel} from 'image-reader-helper';
let model:ImageModel=ImageReader.read('path to your file');
Or using a Buffer:
let buffer = fs.readFileSync('path to your file');
let model:ImageModel=ImageReader.read(buffer);
The ImageModel class have this Properties:
width
: Image Width in pixels.height
: Image Height in pixels.plaette
: Array of ImageColor with all the disctint colours of the image.(Palette Color).data
: Array with all the pixels of the image. each pixel is 4 bytes in the array[r,g,b,a,r,g,b,a...]
.
The Image Color class have this properties:
r
: Red value (0-255).g
: Green value (0-255).b
: Blue value (0-255).a
: Alpha value (0-255).
0.0.1
3 years ago