1.2.0 • Published 5 years ago

base64-image-utils v1.2.0

Weekly downloads
13
License
BSD-3-Clause
Repository
github
Last release
5 years ago

base64 image utils

Utils for base64 image data.

Installation

npm i base64-image-utils

Usage

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

const {base64ImageToRGBMatrix, base64ImageToRGBArray, base64ImageToImageData} = base64ImageUtils

base64ImageToImageData(imgSrc, function(err, rawData, img) {

})

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.

1.2.0

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

6 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago