Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

imageinfo

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imageinfo

A node.js package that returns information about an image or flash file such as type, dimensions etc.

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

node-imageinfo

This is a small package for node.js to allow the analysis of image data in a Buffer, and return mime-type, and image dimensions for the data.

It is designed to be fast, completely written in javascript and have no dependencies on external packages or libraries.

Currently it supports Png, Jpeg, Gif and (uncompressed) Swf analysis.

If you also have zlib available (npm install zlib) then it will support compressed Swf files.

Usage:

To install imageinfo into your project, use npm install imageinfo, then it's simply a matter of calling it with the buffer object containing your image, like this:

var imageinfo = require('imageinfo'),
	fs = require('fs');

fs.readFile('testimage', function(err, data) {
	if (err) throw err;

	info = imageinfo(data);
	console.log("Data is type:", info.mimeType);
	console.log("  Size:", data.length, "bytes");
	console.log("  Dimensions:", info.width, "x", info.height);
});

Keywords

FAQs

Package last updated on 04 Sep 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc