base64-image-utils
Advanced tools
Comparing version 1.1.2 to 1.1.3
{ | ||
"name": "base64-image-utils", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Utils for base64 image data.", | ||
@@ -14,4 +14,4 @@ "main": "index.js", | ||
"keywords": ["base64", "image", "imagedata", "base64image"], | ||
"author": "hi@javier.xyz", | ||
"license": "ISC", | ||
"author": "Javier Bórquez <hi@javier.xyz> (http://github.com/javierbyte)", | ||
"license": "MIT", | ||
"bugs": { | ||
@@ -18,0 +18,0 @@ "url": "https://github.com/javierbyte/base64-image-utils/issues" |
@@ -5,5 +5,4 @@ # base64 image utils | ||
# Installation | ||
``` | ||
npm i base64-image-utils --save | ||
npm i base64-image-utils | ||
``` | ||
@@ -13,16 +12,32 @@ | ||
```js | ||
var base64ImageUtils = require('base64-image-utils') | ||
const base64ImageUtils = require('base64-image-utils') | ||
var {base64ImageToRGBMatrix, base64ImageToRGBArray, base64ImageToImageData} = base64ImageUtils | ||
const {base64ImageToRGBMatrix, base64ImageToRGBArray, base64ImageToImageData} = base64ImageUtils | ||
base64ImageToImageData(imgSrc, function(err, rawData, img) { | ||
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: | ||
{ | ||
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>, | ||
@@ -33,23 +48,7 @@ g: <Green 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. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7348
52