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

get-pixels

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-pixels

Reads the pixels of an image as an ndarray

  • 3.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
191K
decreased by-10.64%
Maintainers
1
Weekly downloads
 
Created

What is get-pixels?

The get-pixels npm package is used to read and decode image files into pixel data. It supports various image formats such as PNG, JPEG, GIF, and BMP. This package is useful for applications that need to process or analyze image data at the pixel level.

What are get-pixels's main functionalities?

Load Image from File

This feature allows you to load an image from a file and get its pixel data. The pixel data is returned as a multi-dimensional array.

const getPixels = require('get-pixels');
getPixels('path/to/image.png', function(err, pixels) {
  if (err) {
    console.log('Failed to load image:', err);
    return;
  }
  console.log('Pixels:', pixels);
});

Load Image from URL

This feature allows you to load an image from a URL and get its pixel data. This is useful for processing images hosted on the web.

const getPixels = require('get-pixels');
getPixels('http://example.com/image.jpg', function(err, pixels) {
  if (err) {
    console.log('Failed to load image:', err);
    return;
  }
  console.log('Pixels:', pixels);
});

Load Image from Buffer

This feature allows you to load an image from a buffer and get its pixel data. This is useful for processing images that are already loaded into memory.

const getPixels = require('get-pixels');
const fs = require('fs');
const buffer = fs.readFileSync('path/to/image.png');
getPixels(buffer, 'image/png', function(err, pixels) {
  if (err) {
    console.log('Failed to load image:', err);
    return;
  }
  console.log('Pixels:', pixels);
});

Other packages similar to get-pixels

Keywords

FAQs

Package last updated on 29 Mar 2015

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