Comparing version 0.2.18 to 0.2.19
@@ -1,2 +0,2 @@ | ||
var Jimp = require("./index.js"); | ||
var Jimp = require("jimp"); | ||
@@ -3,0 +3,0 @@ var url = "https://upload.wikimedia.org/wikipedia/commons/0/01/Bot-Test.jpg"; |
17
index.js
@@ -659,2 +659,9 @@ var FS = require("fs"); | ||
// an array storing the maximum string length of hashes at various bases | ||
var maxHashLength = []; | ||
for (var i = 0; i < 65; i++) { | ||
var l = (i > 1) ? (new BigNumber(Array(64 + 1).join("1"), 2)).toString(i) : NaN; | ||
maxHashLength.push(l.length); | ||
} | ||
/** | ||
@@ -678,6 +685,10 @@ * Generates a perceptual hash of the image <https://en.wikipedia.org/wiki/Perceptual_hashing>. | ||
var hash = (new ImagePHash()).getHash(this); | ||
var base64 = (new BigNumber(hash, 2)).toString(base); | ||
hash = (new BigNumber(hash, 2)).toString(base); | ||
if (isNodePattern(cb)) return cb.call(this, null, base64); | ||
else return base64; | ||
while (hash.length < maxHashLength[base]) { | ||
hash = "0" + hash; // pad out with leading zeros | ||
} | ||
if (isNodePattern(cb)) return cb.call(this, null, hash); | ||
else return hash; | ||
} | ||
@@ -684,0 +695,0 @@ |
{ | ||
"name": "jimp", | ||
"version": "0.2.18", | ||
"version": "0.2.19", | ||
"description": "An image processing library written entirely in JavaScript (i.e. zero external or native dependencies).", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
104007
1998