0.2.0 • Published 4 years ago

@zerodeps/image-probe v0.2.0

Weekly downloads
240
License
MIT
Repository
github
Last release
4 years ago

image-probe

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

Installation

npm install --save @zerodeps/image-probe

Usage

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 FormatTypeMIME Type
JPEGjpegimage/jpeg
JPEG 2000jp2image/jp2
GIF (87a)gifimage/gif
GIF (89a)gifimage/gif
PNGpngimage/png
PNG (IHDR)pngimage/png
WEBP (VP8)webpimage/webp
WEBP (VP8L)webpimage/webp
WEBP (VP8X)webpimage/webp
BMPbmpimage/bmp
0.1.0

4 years ago

0.2.0

4 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago