# @zerodeps/image-probe

> Get image type and size from the first bytes, without needing to read or download it in full ... And without any NPM additional dependencies!

Latest version **0.2.0** (published 2020-09-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @zerodeps/image-probe
pnpm add @zerodeps/image-probe
yarn add @zerodeps/image-probe
bun add @zerodeps/image-probe
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2020-09-19 |
| First published | 2019-10-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 31.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Arturo Arévalo González |
| Maintainers | arturoarevalo |
| Keywords | typescript, module, template |

## Links

- npm: https://www.npmjs.com/package/@zerodeps/image-probe
- Repository: https://github.com/zerodeps-io/image-probe
- Homepage: https://github.com/zerodeps-io/image-probe#readme
- Issues: https://github.com/zerodeps-io/image-probe/issues
- npm.io page: https://npm.io/package/@zerodeps/image-probe

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2020-09-19
- 0.1.0 — 2020-09-19
- 0.0.3 — 2019-10-15
- 0.0.2 — 2019-10-15
- 0.0.1 — 2019-10-15

## README

# image-probe

Get image format and dimensions quickly and efficiently. Without any single additional dependency!

## Installation

npm install --save @zerodeps/image-probe

## Usage

```typescript
import { ImageProbe } from "@zerodeps/image-probe";

const buffer = readFileSync("image.jpg");

const results = ImageProbe.fromBuffer(buffer);
if (results === undefined) {
    // NOT AN IMAGE!!!
} else {
    /* results contains:
    {
        type: "jpeg",
        mimeType: "image/jpeg",
        width: 512,
        height: 256
    }
    */
}
```

## Supported image type formats

| Image Format | Type | MIME Type  |
| ------------ | ---- | ---------- |
| JPEG         | jpeg | image/jpeg |
| JPEG 2000    | jp2  | image/jp2  |
| GIF (87a)    | gif  | image/gif  |
| GIF (89a)    | gif  | image/gif  |
| PNG          | png  | image/png  |
| PNG (IHDR)   | png  | image/png  |
| WEBP (VP8)   | webp | image/webp |
| WEBP (VP8L)  | webp | image/webp |
| WEBP (VP8X)  | webp | image/webp |
| BMP          | bmp  | image/bmp  |

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