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

jimp

Package Overview
Dependencies
Maintainers
1
Versions
281
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jimp - npm Package Compare versions

Comparing version 0.2.21 to 0.2.22

browser/browserify-build.sh

18

package.json
{
"name": "jimp",
"version": "0.2.21",
"version": "0.2.22",
"description": "An image processing library written entirely in JavaScript (i.e. zero external or native dependencies).",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "./test/tests.sh",
"prepublish": "./browser/browserify-build.sh"
},

@@ -29,3 +30,3 @@ "keywords": [

"file-type": "^3.1.0",
"jpeg-js": "^0.1.1",
"jpeg-js": "^0.1.2",
"mime": "^1.3.4",

@@ -40,2 +41,13 @@ "pixelmatch": "^4.0.0",

},
"devDependencies": {
"babel": "^6.0.14",
"babel-cli": "^6.0.0",
"babel-preset-es2015": "^6.0.14",
"babel-preset-stage-0": "^6.0.14",
"browserify": "^13.0.0",
"envify": "^3.4.0",
"express": "^4.13.4",
"uglify-js": "^2.6.1",
"uglifyify": "^3.0.1"
},
"repository": {

@@ -42,0 +54,0 @@ "type": "git",

@@ -5,3 +5,3 @@ # Jimp #

An image processing library for Node written entirely in JavaScript, with zero external or native dependencies.
An image processing library for Node written entirely in JavaScript, with zero external or native dependencies. Install using `npm install --save jimp`.

@@ -36,3 +36,5 @@ Example usage:

Now also available for use in the browser for image manipulation in web workers without `<canvas>`. See [`browser/README.md`](https://github.com/oliver-moran/jimp/blob/master/browser/README.md).
## Basic usage ##

@@ -56,3 +58,2 @@

```js

@@ -82,4 +83,5 @@ Jimp.read(lenna.buffer, function (err, image) {

image.opacity( f ); // multiply the alpha channel by each pixel by the factor f, 0 - 1
image.resize( w, h ); // resize the image. Jimp.AUTO can be passed as one of the values.
image.resize( w, h[, mode] ); // resize the image. Jimp.AUTO can be passed as one of the values. Optionally, a resize mode can be passed.
image.scale( f ); // scale the image by the factor f
image.scaleToFit( w, h ); // scale the image to the largest size that fits inside the given width and height
image.rotate( deg[, resize] ); // rotate the image clockwise by a number of degrees. Unless `false` is passed as the second parameter, the image width and height will be resized appropriately.

@@ -94,4 +96,4 @@ image.blit( src, x, y[, srcx, srcy, srcw, srch] );

image.dither565(); // ordered dithering of the image and reduce color space to 16-bits (RGB565)
image.cover( w, h ); // scale the image so that it fills the given width and height
image.contain( w, h ); // scale the image to the largest size so that fits inside the given width and height
image.cover( w, h ); // scale the image to the given width and height, some parts of the image may be clipped
image.contain( w, h ); // scale the image to the given width and height, some parts of the image may be letter boxed
image.background( hex ); // set the default new pixel colour (e.g. 0xFFFFFFFF or 0x00000000) for by some operations (e.g. image.contain and image.rotate) and when writing formats that don't support alpha channels

@@ -106,2 +108,28 @@ image.mirror( horz, vert ); // an alias for flip

### Resize modes ###
The default rezing algorithm uses a bilinear method as follows:
```js
image.resize(250, 250); // resize the image to 250 x 250
image.resize(Jimp.AUTO, 250); // resize the height to 250 and scale the width accordingly
image.resize(250, Jimp.AUTO); // resize the width to 250 and scale the height accordingly
```
Optionally, the following constants can be passed to choose a particular resizing algorithm:
```js
Jimp.RESIZE_NEAREST_NEIGHBOR;
Jimp.RESIZE_BILINEAR;
Jimp.RESIZE_BICUBIC;
Jimp.RESIZE_HERMITE;
Jimp.RESIZE_BEZIER;
```
For example:
```js
image.resize(250, 250, Jimp.RESIZE_BEZIER);
```
## Writing to files and buffers ##

@@ -276,5 +304,5 @@

There are 18,446,744,073,709,551,615 unique hashes. The hammering distance between the binary representation of these hashes can be used to find similar-looking images.
There are 18,446,744,073,709,551,615 unique hashes. The hamming distance between the binary representation of these hashes can be used to find similar-looking images.
To calculate the hammering distance between two Jimp images based on their perceptual hash use:
To calculate the hamming distance between two Jimp images based on their perceptual hash use:

@@ -293,3 +321,3 @@ ```js

Using a mix of hammering distance and pixel diffing to comare images, the following code has a 99% success rate of detecting the same image from a random sample (with 1% false positives). The test this figure is drawn from attempts to match each image from a sample of 120 PNGs against 120 corresponing JPEGs saved at a quality setting of 60.
Using a mix of hamming distance and pixel diffing to comare images, the following code has a 99% success rate of detecting the same image from a random sample (with 1% false positives). The test this figure is drawn from attempts to match each image from a sample of 120 PNGs against 120 corresponing JPEGs saved at a quality setting of 60.

@@ -296,0 +324,0 @@ ```js

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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