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

@eris/image

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eris/image - npm Package Compare versions

Comparing version 0.3.1-alpha.8 to 0.3.1-alpha.9

2

dist/node-image.d.ts

@@ -8,3 +8,3 @@ import * as sharp from 'sharp';

private readonly _metadata;
constructor(image: sharp.SharpInstance, metadata?: object);
constructor(image: sharp.Sharp, metadata?: object);
private _applyFormat;

@@ -11,0 +11,0 @@ private _applyResize;

@@ -108,18 +108,18 @@ "use strict";

}
image = image.resize(width, height);
let sharpFit;
switch (fit) {
case types_1.ImageResizeFit.Contain:
image = image.max();
sharpFit = 'inside';
break;
case types_1.ImageResizeFit.Cover:
image = image.min();
sharpFit = 'outside';
break;
case types_1.ImageResizeFit.Exact:
image = image.ignoreAspectRatio();
sharpFit = 'fill';
break;
case types_1.ImageResizeFit.Crop:
default:
image = image.crop(sharp.gravity.center);
sharpFit = 'cover';
}
return image;
return image.resize(width, height, { fit: sharpFit });
});

@@ -126,0 +126,0 @@ }

@@ -18,3 +18,3 @@ import * as sharp from 'sharp'

class SharpImage {
public static from(bufferOrImageData: BufferLike | IAnnotatedImageData): sharp.SharpInstance {
public static from(bufferOrImageData: BufferLike | IAnnotatedImageData): sharp.Sharp {
if (ImageData.probablyIs(bufferOrImageData)) {

@@ -39,3 +39,3 @@ let imageData = ImageData.normalize(bufferOrImageData)

public static toMetadata(image: sharp.SharpInstance): Promise<IMetadata> {
public static toMetadata(image: sharp.Sharp): Promise<IMetadata> {
return image.metadata().then(metadata => {

@@ -57,3 +57,3 @@ let {width = 0, height = 0} = metadata

public static async toImageData(image: sharp.SharpInstance): Promise<IAnnotatedImageData> {
public static async toImageData(image: sharp.Sharp): Promise<IAnnotatedImageData> {
const rawData = await (image.clone().raw().toBuffer as any)({resolveWithObject: true})

@@ -74,6 +74,6 @@ const {width, height, size} = rawData.info

export class NodeImage extends Image {
private readonly _image: sharp.SharpInstance
private readonly _image: sharp.Sharp
private readonly _metadata: object | undefined
public constructor(image: sharp.SharpInstance, metadata?: object) {
public constructor(image: sharp.Sharp, metadata?: object) {
super()

@@ -84,3 +84,3 @@ this._image = image

private _applyFormat(image: sharp.SharpInstance): sharp.SharpInstance {
private _applyFormat(image: sharp.Sharp): sharp.Sharp {
const {format = DEFAULT_FORMAT} = this._output

@@ -98,3 +98,3 @@ if (format.type === ImageFormat.JPEG) {

private async _applyResize(image: sharp.SharpInstance): Promise<sharp.SharpInstance> {
private async _applyResize(image: sharp.Sharp): Promise<sharp.Sharp> {
if (!this._output.resize) {

@@ -120,22 +120,22 @@ return image

image = image.resize(width, height)
let sharpFit: sharp.ResizeOptions['fit']
switch (fit) {
case ImageResizeFit.Contain:
image = image.max()
sharpFit = 'inside'
break
case ImageResizeFit.Cover:
image = image.min()
sharpFit = 'outside'
break
case ImageResizeFit.Exact:
image = image.ignoreAspectRatio()
sharpFit = 'fill'
break
case ImageResizeFit.Crop:
default:
image = image.crop(sharp.gravity.center)
sharpFit = 'cover'
}
return image
return image.resize(width, height, {fit: sharpFit})
}
private _applyGreyscale(image: sharp.SharpInstance): sharp.SharpInstance {
private _applyGreyscale(image: sharp.Sharp): sharp.Sharp {
if (!this._output.greyscale || this._output.edges) {

@@ -148,5 +148,3 @@ return image

private async _applyImageDataTransforms(
image: sharp.SharpInstance,
): Promise<sharp.SharpInstance> {
private async _applyImageDataTransforms(image: sharp.Sharp): Promise<sharp.Sharp> {
if (

@@ -174,3 +172,3 @@ !this._output.effects &&

private async _applyAll(imagePromise: sharp.SharpInstance): Promise<sharp.SharpInstance> {
private async _applyAll(imagePromise: sharp.Sharp): Promise<sharp.Sharp> {
let image = await imagePromise

@@ -177,0 +175,0 @@

{
"name": "@eris/image",
"version": "0.3.1-alpha.8",
"version": "0.3.1-alpha.9",
"description": "Collection of image manipulation libraries for node and the browser.",

@@ -38,3 +38,4 @@ "main": "./dist/node-index.js",

"dependencies": {
"@eris/exif": "0.3.1-alpha.8",
"@eris/exif": "0.3.1-alpha.9",
"@types/sharp": "^0.22.0",
"buffer": "^5.2.0",

@@ -44,3 +45,3 @@ "file-type": "^7.0.1",

"pngjs": "^3.3.0",
"sharp": "^0.18.4"
"sharp": "^0.22.0"
},

@@ -50,3 +51,2 @@ "devDependencies": {

"@types/node": "^7.0.18",
"@types/sharp": "^0.17.1",
"babili": "^0.1.2",

@@ -73,3 +73,3 @@ "chai": "^3.5.0",

},
"gitHead": "95077f78063a814ec94b18b93e8c0c658c5b8ee9"
"gitHead": "e2d64d60a7d47afc31f318140b91c8f33243a179"
}

Sorry, the diff of this file is not supported yet

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