New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-js-image

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-js-image - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

local.js

5

package.json
{
"name": "node-js-image",
"version": "0.0.3",
"version": "0.0.4",
"description": "Manipulate Images in Node.js",
"main": "index.js",
"scripts": {
"test": "jest"
"test": "jest",
"local": "node local.js"
},

@@ -9,0 +10,0 @@ "repository": {

34

src/image.js
const fs = require('fs')
const jpeg = require('jpeg-js')
const proc = require('./processing')
/** @typedef { number[] } Array1D One Dimensional Array */

@@ -216,13 +218,34 @@ /** @typedef { number[][] } Array2D Two Dimensional Array */

reduce() {
this._processImage(proc.reduce)
return this
}
/**
*
* @param {boolean} [soft=true]
*/
mask (soft = true) {
if(soft) {
this.grayscale()
} else {
this.blackwhite()
}
this.reduce()
return this
}
blackwhite () {
/** @param {Array1D} data */
const fn = data => data.map(px => Math.round(px / 255) === 1 ? 255 : 0)
this._processImage(fn)
this._processImage(proc.blackwhite)
return this
}
grayscale () {
this._processImage(proc.grayscale)
return this
}
invert () {
/** @param {Array1D} data */
const fn = data => data.map(px => Math.abs(px - 255))
this._processImage(fn)
this._processImage(proc.invert)
return this

@@ -331,2 +354,3 @@ }

this.shape = initValues.shape
this.isFlat = true
}

@@ -333,0 +357,0 @@ return this

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