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

base64-image-utils

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base64-image-utils

Utils for base64 image data.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19
increased by26.67%
Maintainers
1
Weekly downloads
 
Created
Source

base64 image utils

Utils for base64 image data.

Installation

  npm i base64-image-utils --save

Usage

  var base64ImageUtils = require('base64-image-utils')

  var {base64ImageToRGBMatrix, base64ImageToRGBArray, base64ImageToImageData} = base64ImageUtils

  base64ImageToImageData(imgSrc, function(err, data, img) {
    /*
      data is a matrix with rows and columns that corresponds
      to every pixel of the image, where each pixel is represented
      as:
        {
          r: <Red value of the color>,
          g: <Green value of the color>,
          b: <Blue value of the color>,
          a: <Alpha value of the color>
        }
    */
  })

  base64ImageToRGBMatrix(imgSrc, function(err, data) {
    /*
      data is a matrix with rows and columns that corresponds
      to every pixel of the image, where each pixel is represented
      as:
        {
          r: <Red value of the color>,
          g: <Green value of the color>,
          b: <Blue value of the color>,
          a: <Alpha value of the color>
        }
    */
  })

  base64ImageToRGBArray(imgSrc, function(err, data) {
    /*
      data is an array with every pixel described as:
      as:
        {
          x: <X position of the pixel>,
          y: <Y position of the pixel>,
          rgb: {
            r: <Red value of the color>,
            g: <Green value of the color>,
            b: <Blue value of the color>,
            a: <Alpha value of the color>
          }
        }
    */
  })

You can optionally send a third options parameter, which is an object that can hold width or maxWidth values.

Keywords

FAQs

Package last updated on 28 Aug 2017

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