node-js-image
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "node-js-image", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Manipulate Images in Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
const fs = require('fs') | ||
const jpeg = require('jpeg-js') | ||
/** @typedef { number[] } Array1D One Dimensional Array */ | ||
/** @typedef { number[][] } Array2D Two Dimensional Array */ | ||
/** @typedef { number[][][] } Array3D Three Dimensional Array */ | ||
/** @typedef { number[] } Array1D One Dimensional Array */ | ||
/** @typedef { number[][] } Array2D Two Dimensional Array */ | ||
/** @typedef { number[][][] } Array3D Three Dimensional Array */ | ||
@@ -94,4 +94,3 @@ /** | ||
fromBuffer (buffer) { | ||
const decoded = this.decode(buffer, { useTArray: true }) | ||
const { data, width, height } = decoded | ||
const { data, width, height } = this.decode(buffer, { useTArray: true }) | ||
this.data = Array.from(data) | ||
@@ -228,5 +227,7 @@ this.width = width | ||
pixels () { | ||
if(!this.isFlat) { this.flatten() } | ||
if (!this.isFlat) { | ||
return this | ||
} | ||
const [width, height, slice] = [this.width, this.height, this.channels] | ||
const [width, height, slice] = this.shape | ||
const n = this.data.length | ||
@@ -233,0 +234,0 @@ |
279
9855