png-info

0.0.1 • Public • Published

png-info

Get information about a PNG from its headers

Install

npm install png-info

Usage

Most common lookups will have methods on pngInfo:

var image = fs.readFileSync('path/to/image.png');
var pngInfo = new PNGInfo(image);
var dimensions = pngInfo.getDimensions();
// {width: 100, height: 150 }
});

If you want to go deeper, you can access chunk data directly:

var image = fs.readFileSync('path/to/image.png');
var pngInfo = new PNGInfo(image);
var width = pngInfo.chunks.IHDR.width;
// 100

Status

Only IHDR is currently implemented, please feel free to add any other chunks that you need:

  • IHDR
  • PLTE
  • tRNS
  • gAMA
  • cHRM
  • sRGB
  • iCCP
  • tEXt
  • bKGD
  • pHYs
  • sBIT
  • sPLT
  • hIST
  • tIME

Development

npm test

Please keep coverage at 100%

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    2

Package Sidebar

Install

npm i png-info

Weekly Downloads

2

Version

0.0.1

License

MIT

Last publish

Collaborators

  • willyham