https://github.com/zerasul/image-reader-helper
Image Reader Helper Lib Written in TypeScript
https://github.com/zerasul/image-reader-helper
Last synced: about 1 year ago
JSON representation
Image Reader Helper Lib Written in TypeScript
- Host: GitHub
- URL: https://github.com/zerasul/image-reader-helper
- Owner: zerasul
- License: mit
- Created: 2021-05-25T21:38:55.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-18T04:04:51.000Z (over 2 years ago)
- Last Synced: 2025-04-14T21:06:56.585Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 165 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Image Read Helper
[](https://github.com/zerasul/image-reader-helper/actions/workflows/main.yml) [](https://www.npmjs.com/package/@zerasul/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```.
```bash
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.
```typescript
import {ImageReader,ImageModel} from 'image-reader-helper';
let model:ImageModel=ImageReader.read('path to your file');
```
Or using a Buffer:
```typescript
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).