# image-utilites

> Grayscale detector

Latest version **0.2.2** (published 2020-12-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install image-utilites
pnpm add image-utilites
yarn add image-utilites
bun add image-utilites
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2020-12-29 |
| First published | 2020-08-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 106.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Konstantin Shevsky |
| Maintainers | shevsky |
| Keywords | grayscale, image |

## Links

- npm: https://www.npmjs.com/package/image-utilites
- Repository: https://github.com/Shevsky/image-utilites
- Homepage: https://shevsky.github.io/image-utilites
- Issues: https://github.com/Shevsky/image-utilites/issues
- npm.io page: https://npm.io/package/image-utilites

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 0.2.2 (latest) — 2020-12-29
- 0.2.1 — 2020-09-22
- 0.2.0 — 2020-09-08
- 0.1.1 — 2020-08-31
- 0.1.0 — 2020-08-26
- 0.0.1 — 2020-08-17

## README

# Image Utilites
Utilites for working with Blob of image.

## Installation
>npm i image-utilites
>
>yarn add image-utilites

## Playground
https://shevsky.github.io/image-utilites/

## ImageColorTypeReader
Can detect is image is grayscale or colored.

```javascript
import { ImageColorTypeReader } from 'image-utilites';

const imageColorTypeReader = new ImageColorTypeReader();
imageColorTypeReader.read(file).then(colorType => console.log(colorType)); // Don't forget to catch errors!
```

### Configuration
ImageColorTypeReader constructor takes a config object.

Name | Description | Type | Default value
--- | --- | --- | ---
grayscaleThreshold | By default, reader determines is an image is grayscale if red === green === blue. This parameter allows to set the max difference between colors to assume that image is grayscale. | number (0-255) | 0
minifySize | When reader starting to work it will resize source image to width and height not longer that passed value in order to reduce a pixels count. | number | 300

## Result
ImageColorTypeReader returns a promise that resolves `grayscale` or `colored` (enum IMAGE_COLOR_TYPE).

## MimeTypeReader
Can provide mime type of image.

```javascript
import { MimeTypeReader } from 'image-utilites';

MimeTypeReader.read(file).then(mimeType => console.log(mimeType)); // Don't forget to catch errors!
```

## Result
MimeTypeReader returns a promise that resolves `image/gif`, `image/jpeg`, `application/pdf`, `image/png`, `image/webp
` (enum MIME_TYPE).

---
_Source: https://npm.io/package/image-utilites · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
