Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fatelei/imagetype

Get correct image type
https://github.com/fatelei/imagetype

Last synced: about 1 month ago
JSON representation

Get correct image type

Awesome Lists containing this project

README

        

imagetype
=========

Get correct image type

## Install
```
npm install imtype
```

## Support Image type
+ jpeg
+ png
+ gif
+ tiff
+ bmp

- - -
## Usage
```
var imtype = require('imtype');
var fs = require('fs');

// isJPG;
var data = fs.readFileSync('foo.jpg');
console.log(imtype.isJPG(data));

// isPNG
var data = fs.readFileSync('foo.png');
console.log(imtype.isPNG(data));

// isGIF
var data = fs.readFileSync('foo.gif');
console.log(imtype.isGIF(data));

// isBMP
var data = fs.readFileSync('foo.bmp');
console.log(imtype.isBMP(data));

// isTIF
var data = fs.readFileSync('foo.tif');
console.log(imtype.isTIF(data));
```

## Test
```
make test
```