🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

sharp

Package Overview
Dependencies
Maintainers
1
Versions
189
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sharp - npm Package Compare versions

Comparing version
0.34.0-rc.0
to
0.34.0-rc.1
+4
-0
lib/constructor.js

@@ -266,2 +266,4 @@ // Copyright 2013 Lovell Fuller and others.

trimLineArt: false,
dilateWidth: 0,
erodeWidth: 0,
gamma: 0,

@@ -300,2 +302,4 @@ gammaOut: 0,

resolveWithObject: false,
loop: 1,
delay: [],
// output format

@@ -302,0 +306,0 @@ jpegQuality: 80,

+3
-1

@@ -116,3 +116,5 @@ // Copyright 2013 Lovell Fuller and others.

const identHash = sha512(`imgsharp-libvips-${buildPlatformArch()}`);
const npmVersion = semverCoerce(optionalDependencies[`@img/sharp-libvips-${buildPlatformArch()}`]).version;
const npmVersion = semverCoerce(optionalDependencies[`@img/sharp-libvips-${buildPlatformArch()}`], {
includePrerelease: true
}).version;
return sha512(`${identHash}npm:${npmVersion}`).slice(0, 10);

@@ -119,0 +121,0 @@ } catch {}

@@ -447,2 +447,48 @@ // Copyright 2013 Lovell Fuller and others.

/**
* Expand foreground objects using the dilate morphological operator.
*
* @example
* const output = await sharp(input)
* .dilate()
* .toBuffer();
*
* @param {Number} [width=1] dilation width in pixels.
* @returns {Sharp}
* @throws {Error} Invalid parameters
*/
function dilate (width) {
if (!is.defined(width)) {
this.options.dilateWidth = 1;
} else if (is.integer(width) && width > 0) {
this.options.dilateWidth = width;
} else {
throw is.invalidParameterError('dilate', 'positive integer', dilate);
}
return this;
}
/**
* Shrink foreground objects using the erode morphological operator.
*
* @example
* const output = await sharp(input)
* .erode()
* .toBuffer();
*
* @param {Number} [width=1] erosion width in pixels.
* @returns {Sharp}
* @throws {Error} Invalid parameters
*/
function erode (width) {
if (!is.defined(width)) {
this.options.erodeWidth = 1;
} else if (is.integer(width) && width > 0) {
this.options.erodeWidth = width;
} else {
throw is.invalidParameterError('erode', 'positive integer', erode);
}
return this;
}
/**
* Merge alpha transparency channel, if any, with a background, then remove the alpha channel.

@@ -962,2 +1008,4 @@ *

sharpen,
erode,
dilate,
median,

@@ -964,0 +1012,0 @@ blur,

@@ -20,5 +20,5 @@ // Copyright 2013 Lovell Fuller and others.

let sharp;
let path, sharp;
const errors = [];
for (const path of paths) {
for (path of paths) {
try {

@@ -34,2 +34,10 @@ sharp = require(path);

/* istanbul ignore next */
if (sharp && path.startsWith('@img/sharp-linux-x64') && !sharp._isUsingX64V2()) {
const err = new Error('Prebuilt binaries for linux-x64 require v2 microarchitecture');
err.code = 'Unsupported CPU';
errors.push(err);
sharp = null;
}
/* istanbul ignore next */
if (sharp) {

@@ -36,0 +44,0 @@ module.exports = sharp;

{
"name": "sharp",
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",
"version": "0.34.0-rc.0",
"version": "0.34.0-rc.1",
"author": "Lovell Fuller <npm@lovell.info>",

@@ -145,32 +145,32 @@ "homepage": "https://sharp.pixelplumbing.com",

"optionalDependencies": {
"@img/sharp-darwin-arm64": "0.34.0-rc.0",
"@img/sharp-darwin-x64": "0.34.0-rc.0",
"@img/sharp-libvips-darwin-arm64": "1.1.0-rc4",
"@img/sharp-libvips-darwin-x64": "1.1.0-rc4",
"@img/sharp-libvips-linux-arm": "1.1.0-rc4.1",
"@img/sharp-libvips-linux-arm64": "1.1.0-rc4",
"@img/sharp-libvips-linux-ppc64": "1.1.0-rc4",
"@img/sharp-libvips-linux-s390x": "1.1.0-rc4",
"@img/sharp-libvips-linux-x64": "1.1.0-rc4",
"@img/sharp-libvips-linuxmusl-arm64": "1.1.0-rc4",
"@img/sharp-libvips-linuxmusl-x64": "1.1.0-rc4",
"@img/sharp-linux-arm": "0.34.0-rc.0",
"@img/sharp-linux-arm64": "0.34.0-rc.0",
"@img/sharp-linux-s390x": "0.34.0-rc.0",
"@img/sharp-linux-x64": "0.34.0-rc.0",
"@img/sharp-linuxmusl-arm64": "0.34.0-rc.0",
"@img/sharp-linuxmusl-x64": "0.34.0-rc.0",
"@img/sharp-wasm32": "0.34.0-rc.0",
"@img/sharp-win32-ia32": "0.34.0-rc.0",
"@img/sharp-win32-x64": "0.34.0-rc.0"
"@img/sharp-darwin-arm64": "0.34.0-rc.1",
"@img/sharp-darwin-x64": "0.34.0-rc.1",
"@img/sharp-libvips-darwin-arm64": "1.1.0-rc5",
"@img/sharp-libvips-darwin-x64": "1.1.0-rc5",
"@img/sharp-libvips-linux-arm": "1.1.0-rc5",
"@img/sharp-libvips-linux-arm64": "1.1.0-rc5",
"@img/sharp-libvips-linux-ppc64": "1.1.0-rc5",
"@img/sharp-libvips-linux-s390x": "1.1.0-rc5",
"@img/sharp-libvips-linux-x64": "1.1.0-rc5",
"@img/sharp-libvips-linuxmusl-arm64": "1.1.0-rc5",
"@img/sharp-libvips-linuxmusl-x64": "1.1.0-rc5",
"@img/sharp-linux-arm": "0.34.0-rc.1",
"@img/sharp-linux-arm64": "0.34.0-rc.1",
"@img/sharp-linux-s390x": "0.34.0-rc.1",
"@img/sharp-linux-x64": "0.34.0-rc.1",
"@img/sharp-linuxmusl-arm64": "0.34.0-rc.1",
"@img/sharp-linuxmusl-x64": "0.34.0-rc.1",
"@img/sharp-wasm32": "0.34.0-rc.1",
"@img/sharp-win32-ia32": "0.34.0-rc.1",
"@img/sharp-win32-x64": "0.34.0-rc.1"
},
"devDependencies": {
"@emnapi/runtime": "^1.3.1",
"@img/sharp-libvips-dev": "1.1.0-rc4",
"@img/sharp-libvips-dev-wasm32": "1.1.0-rc4",
"@img/sharp-libvips-win32-ia32": "1.1.0-rc4",
"@img/sharp-libvips-win32-x64": "1.1.0-rc4",
"@emnapi/runtime": "^1.4.0",
"@img/sharp-libvips-dev": "1.1.0-rc5",
"@img/sharp-libvips-dev-wasm32": "1.1.0-rc5",
"@img/sharp-libvips-win32-ia32": "1.1.0-rc5",
"@img/sharp-libvips-win32-x64": "1.1.0-rc5",
"@types/node": "*",
"cc": "^3.0.1",
"emnapi": "^1.3.1",
"emnapi": "^1.4.0",
"exif-reader": "^2.0.2",

@@ -177,0 +177,0 @@ "extract-zip": "^2.0.1",

@@ -475,2 +475,24 @@ // Copyright 2013 Lovell Fuller and others.

/*
* Dilate an image
*/
VImage Dilate(VImage image, int const width) {
int const maskWidth = 2 * width + 1;
VImage mask = VImage::new_matrix(maskWidth, maskWidth);
return image.morph(
mask,
VIPS_OPERATION_MORPHOLOGY_DILATE).invert();
}
/*
* Erode an image
*/
VImage Erode(VImage image, int const width) {
int const maskWidth = 2 * width + 1;
VImage mask = VImage::new_matrix(maskWidth, maskWidth);
return image.morph(
mask,
VIPS_OPERATION_MORPHOLOGY_ERODE).invert();
}
} // namespace sharp

@@ -123,4 +123,13 @@ // Copyright 2013 Lovell Fuller and others.

/*
* Dilate an image
*/
VImage Dilate(VImage image, int const maskWidth);
/*
* Erode an image
*/
VImage Erode(VImage image, int const maskWidth);
} // namespace sharp
#endif // SRC_OPERATIONS_H_

@@ -104,2 +104,4 @@ // Copyright 2013 Lovell Fuller and others.

std::vector<double> linearB;
int dilateWidth;
int erodeWidth;
double gamma;

@@ -278,2 +280,4 @@ double gammaOut;

linearB{},
dilateWidth(0),
erodeWidth(0),
gamma(0.0),

@@ -385,3 +389,3 @@ greyscale(false),

colourspace(VIPS_INTERPRETATION_LAST),
loop(-1),
loop(1),
tileSize(256),

@@ -388,0 +392,0 @@ tileOverlap(0),

@@ -36,2 +36,3 @@ // Copyright 2013 Lovell Fuller and others.

exports.Set("_isUsingJemalloc", Napi::Function::New(env, _isUsingJemalloc));
exports.Set("_isUsingX64V2", Napi::Function::New(env, _isUsingX64V2));
exports.Set("stats", Napi::Function::New(env, stats));

@@ -38,0 +39,0 @@ return exports;

@@ -270,1 +270,18 @@ // Copyright 2013 Lovell Fuller and others.

#endif
#if defined(__GNUC__) && defined(__x86_64__)
// Are SSE 4.2 intrinsics available at runtime?
Napi::Value _isUsingX64V2(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
unsigned int eax, ebx, ecx, edx;
__asm__ __volatile__("cpuid"
: "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)
: "a"(1));
return Napi::Boolean::New(env, (ecx & 1U << 20) != 0);
}
#else
Napi::Value _isUsingX64V2(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
return Napi::Boolean::New(env, false);
}
#endif

@@ -18,3 +18,4 @@ // Copyright 2013 Lovell Fuller and others.

Napi::Value _isUsingJemalloc(const Napi::CallbackInfo& info);
Napi::Value _isUsingX64V2(const Napi::CallbackInfo& info);
#endif // SRC_UTILITIES_H_

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

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