Socket
Socket
Sign inDemoInstall

@jimp/plugin-crop

Package Overview
Dependencies
Maintainers
2
Versions
242
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jimp/plugin-crop - npm Package Compare versions

Comparing version 0.21.3 to 0.21.4--canary.1163.a26f5b300ee88c2fadb9909dd390cb4380b32a42.0

12

package.json
{
"name": "@jimp/plugin-crop",
"version": "0.21.3",
"version": "0.21.4--canary.1163.a26f5b300ee88c2fadb9909dd390cb4380b32a42.0",
"description": "crop an image.",

@@ -10,3 +10,3 @@ "main": "dist/index.js",

"scripts": {
"test": "cross-env BABEL_ENV=test mocha --require @babel/register",
"test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
"test:watch": "npm run test -- --reporter min --watch",

@@ -25,7 +25,7 @@ "test:coverage": "nyc npm run test",

"dependencies": {
"@jimp/utils": "^0.21.3"
"@jimp/utils": "0.21.4--canary.1163.a26f5b300ee88c2fadb9909dd390cb4380b32a42.0"
},
"devDependencies": {
"@jimp/custom": "^0.21.3",
"@jimp/test-utils": "^0.21.3"
"@jimp/custom": "0.21.4--canary.1163.a26f5b300ee88c2fadb9909dd390cb4380b32a42.0",
"@jimp/test-utils": "0.21.4--canary.1163.a26f5b300ee88c2fadb9909dd390cb4380b32a42.0"
},

@@ -38,3 +38,3 @@ "peerDependencies": {

},
"gitHead": "046ea0d26952611c74bebd7b13877eb628458aa3"
"gitHead": "a26f5b300ee88c2fadb9909dd390cb4380b32a42"
}

@@ -5,2 +5,3 @@ import { Jimp, mkJGD } from "@jimp/test-utils";

import crop from "../src";
import { expectToBeJGD } from "@jimp/test-utils/src";

@@ -23,8 +24,6 @@ const jimp = configure({ plugins: [crop] }, Jimp);

imgSrc
.autocrop()
.getJGDSync()
.should.be.sameJGD(
mkJGD(" ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ ")
);
expectToBeJGD(
imgSrc.autocrop().getJGDSync(),
mkJGD(" ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ ")
);
});

@@ -45,8 +44,6 @@

imgSrc
.autocrop()
.getJGDSync()
.should.be.sameJGD(
mkJGD("▥▥◆◆▥▥", "▥◆▦▦◆▥", "◆▦▦▦▦◆", "▥◆▦▦◆▥", "▥▥◆◆▥▥")
);
expectToBeJGD(
imgSrc.autocrop().getJGDSync(),
mkJGD("▥▥◆◆▥▥", "▥◆▦▦◆▥", "◆▦▦▦▦◆", "▥◆▦▦◆▥", "▥▥◆◆▥▥")
);
});

@@ -69,8 +66,6 @@

imgSrc
.autocrop()
.getJGDSync()
.should.be.sameJGD(
mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
);
expectToBeJGD(
imgSrc.autocrop().getJGDSync(),
mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
);
});

@@ -92,26 +87,20 @@

);
imgSrc
.clone()
.autocrop()
.getJGDSync()
.should.be.sameJGD(
mkJGD(
"323232323232",
"232323232323",
"32 ◆◆ 32",
"23 ◆▦▦◆ 23",
"32 ◆▦▦▦▦◆ 32",
"23 ◆▦▦◆ 23",
"32 ◆◆ 32",
"232323232323",
"323232323232"
)
);
imgSrc
.clone()
.autocrop(0.005)
.getJGDSync()
.should.be.sameJGD(
mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
);
expectToBeJGD(
imgSrc.clone().autocrop().getJGDSync(),
mkJGD(
"323232323232",
"232323232323",
"32 ◆◆ 32",
"23 ◆▦▦◆ 23",
"32 ◆▦▦▦▦◆ 32",
"23 ◆▦▦◆ 23",
"32 ◆◆ 32",
"232323232323",
"323232323232"
)
);
expectToBeJGD(
imgSrc.clone().autocrop(0.005).getJGDSync(),
mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
);
});

@@ -133,26 +122,20 @@

);
imgSrc
.clone()
.autocrop()
.getJGDSync()
.should.be.sameJGD(
mkJGD(
"323232323232",
"232323232323",
"32 ◆◆ 32",
"23 ◆▦▦◆ 23",
"32 ◆▦▦▦▦◆ 32",
"23 ◆▦▦◆ 23",
"32 ◆◆ 32",
"232323232323",
"323232323232"
)
);
imgSrc
.clone()
.autocrop({ tolerance: 0.005 })
.getJGDSync()
.should.be.sameJGD(
mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
);
expectToBeJGD(
imgSrc.clone().autocrop().getJGDSync(),
mkJGD(
"323232323232",
"232323232323",
"32 ◆◆ 32",
"23 ◆▦▦◆ 23",
"32 ◆▦▦▦▦◆ 32",
"23 ◆▦▦◆ 23",
"32 ◆◆ 32",
"232323232323",
"323232323232"
)
);
expectToBeJGD(
imgSrc.clone().autocrop({ tolerance: 0.005 }).getJGDSync(),
mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
);
});

@@ -173,8 +156,6 @@

imgSrc
.autocrop(false)
.getJGDSync()
.should.be.sameJGD(
mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
);
expectToBeJGD(
imgSrc.autocrop(false).getJGDSync(),
mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
);
});

@@ -195,8 +176,6 @@

imgSrc
.autocrop({ cropOnlyFrames: false })
.getJGDSync()
.should.be.sameJGD(
mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
);
expectToBeJGD(
imgSrc.autocrop({ cropOnlyFrames: false }).getJGDSync(),
mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ")
);
});

@@ -218,15 +197,13 @@

imgSrc
.autocrop({ cropSymmetric: true })
.getJGDSync()
.should.be.sameJGD(
mkJGD(
" ◆◆ ▥▥",
" ◆▦▦◆ ▥▥",
" ◆▦▦▦▦◆ ▥▥",
" ◆▦▦◆ ▥▥",
" ◆◆ ▥▥",
"▥▥▥▥▥▥▥▥▥▥"
)
);
expectToBeJGD(
imgSrc.autocrop({ cropSymmetric: true }).getJGDSync(),
mkJGD(
" ◆◆ ▥▥",
" ◆▦▦◆ ▥▥",
" ◆▦▦▦▦◆ ▥▥",
" ◆▦▦◆ ▥▥",
" ◆◆ ▥▥",
"▥▥▥▥▥▥▥▥▥▥"
)
);
});

@@ -246,16 +223,16 @@

);
imgSrc
.autocrop({ cropSymmetric: true, cropOnlyFrames: false })
.getJGDSync()
.should.be.sameJGD(
mkJGD(
" ◆◆ ▥▥",
" ◆▦▦◆ ▥▥",
" ◆▦▦▦▦◆ ▥▥",
" ◆▦▦◆ ▥▥",
" ◆◆ ▥▥",
"▥▥▥▥▥▥▥▥▥▥",
"▥▥▥▥▥▥▥▥▥▥"
)
);
expectToBeJGD(
imgSrc
.autocrop({ cropSymmetric: true, cropOnlyFrames: false })
.getJGDSync(),
mkJGD(
" ◆◆ ▥▥",
" ◆▦▦◆ ▥▥",
" ◆▦▦▦▦◆ ▥▥",
" ◆▦▦◆ ▥▥",
" ◆◆ ▥▥",
"▥▥▥▥▥▥▥▥▥▥",
"▥▥▥▥▥▥▥▥▥▥"
)
);
});

@@ -278,19 +255,19 @@

imgSrc
.autocrop({
tolerance: 0.005,
leaveBorder: 1,
})
.getJGDSync()
.should.be.sameJGD(
mkJGD(
"3232323232",
"2 ◆◆ 3",
"3 ◆▦▦◆ 2",
"2 ◆▦▦▦▦◆ 3",
"3 ◆▦▦◆ 2",
"2 ◆◆ 3",
"3232323232"
)
);
expectToBeJGD(
imgSrc
.autocrop({
tolerance: 0.005,
leaveBorder: 1,
})
.getJGDSync(),
mkJGD(
"3232323232",
"2 ◆◆ 3",
"3 ◆▦▦◆ 2",
"2 ◆▦▦▦▦◆ 3",
"3 ◆▦▦◆ 2",
"2 ◆◆ 3",
"3232323232"
)
);
});

@@ -312,22 +289,21 @@

);
imgSrc
.autocrop({
tolerance: 0.005,
leaveBorder: 100,
})
.getJGDSync()
.should.be.sameJGD(
mkJGD(
"323232323232",
"232323232323",
"32 ◆◆ 32",
"23 ◆▦▦◆ 23",
"32 ◆▦▦▦▦◆ 32",
"23 ◆▦▦◆ 23",
"32 ◆◆ 32",
"232323232323",
"323232323232"
)
);
expectToBeJGD(
imgSrc
.autocrop({
tolerance: 0.005,
leaveBorder: 100,
})
.getJGDSync(),
mkJGD(
"323232323232",
"232323232323",
"32 ◆◆ 32",
"23 ◆▦▦◆ 23",
"32 ◆▦▦▦▦◆ 32",
"23 ◆▦▦◆ 23",
"32 ◆◆ 32",
"232323232323",
"323232323232"
)
);
});

@@ -351,18 +327,22 @@

);
imgSrc
.autocrop({ cropSymmetric: true, cropOnlyFrames: false, leaveBorder: 2 })
.getJGDSync()
.should.be.sameJGD(
mkJGD(
"▥▥▥▥▥▥▥▥",
"▥▥▥▥▥▥▥▥",
" ◆◆ ",
" ◆▦▦◆ ",
" ◆▦▦▦▦◆ ",
" ◆▦▦◆ ",
" ◆◆ ",
"▥▥▥▥▥▥▥▥",
"▥▥▥▥▥▥▥▥"
)
);
expectToBeJGD(
imgSrc
.autocrop({
cropSymmetric: true,
cropOnlyFrames: false,
leaveBorder: 2,
})
.getJGDSync(),
mkJGD(
"▥▥▥▥▥▥▥▥",
"▥▥▥▥▥▥▥▥",
" ◆◆ ",
" ◆▦▦◆ ",
" ◆▦▦▦▦◆ ",
" ◆▦▦◆ ",
" ◆◆ ",
"▥▥▥▥▥▥▥▥",
"▥▥▥▥▥▥▥▥"
)
);
});

@@ -382,9 +362,8 @@

);
imgSrc
.autocrop({ cropOnlyFrames: false, ignoreSides: { north: true } })
.getJGDSync()
.should.be.sameJGD(
mkJGD(" ", " ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ ")
);
expectToBeJGD(
imgSrc
.autocrop({ cropOnlyFrames: false, ignoreSides: { north: true } })
.getJGDSync(),
mkJGD(" ", " ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ ")
);
});

@@ -405,18 +384,18 @@

imgSrc
.autocrop({
cropOnlyFrames: false,
ignoreSides: { west: true, south: true },
})
.getJGDSync()
.should.be.sameJGD(
mkJGD(
" ◆◆ ",
" ◆▦▦◆ ",
"◆▦▦▦▦◆ ",
" ◆▦▦◆ ",
" ◆◆ ",
" "
)
);
expectToBeJGD(
imgSrc
.autocrop({
cropOnlyFrames: false,
ignoreSides: { west: true, south: true },
})
.getJGDSync(),
mkJGD(
" ◆◆ ",
" ◆▦▦◆ ",
"◆▦▦▦▦◆ ",
" ◆▦▦◆ ",
" ◆◆ ",
" "
)
);
});

@@ -437,9 +416,9 @@

imgSrc
.autocrop({ cropOnlyFrames: false, ignoreSides: { east: true } })
.getJGDSync()
.should.be.sameJGD(
mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ ")
);
expectToBeJGD(
imgSrc
.autocrop({ cropOnlyFrames: false, ignoreSides: { east: true } })
.getJGDSync(),
mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ ")
);
});
});

@@ -5,2 +5,3 @@ import { Jimp, mkJGD } from "@jimp/test-utils";

import crop from "../src";
import { expectToBeJGD } from "@jimp/test-utils/src";

@@ -16,6 +17,6 @@ const jimp = configure({ plugins: [crop] }, Jimp);

imgSrc
.crop(0, 0, 6, 2)
.getJGDSync()
.should.be.sameJGD(mkJGD(" ◆◆ ", " ◆▦▦◆ "));
expectToBeJGD(
imgSrc.crop(0, 0, 6, 2).getJGDSync(),
mkJGD(" ◆◆ ", " ◆▦▦◆ ")
);
});

@@ -26,6 +27,6 @@

imgSrc
.crop(0, 3, 6, 2)
.getJGDSync()
.should.be.sameJGD(mkJGD(" ◆▦▦◆ ", " ◆◆ "));
expectToBeJGD(
imgSrc.crop(0, 3, 6, 2).getJGDSync(),
mkJGD(" ◆▦▦◆ ", " ◆◆ ")
);
});

@@ -36,6 +37,6 @@

imgSrc
.crop(0, 2, 6, 2)
.getJGDSync()
.should.be.sameJGD(mkJGD("◆▦▦▦▦◆", " ◆▦▦◆ "));
expectToBeJGD(
imgSrc.crop(0, 2, 6, 2).getJGDSync(),
mkJGD("◆▦▦▦▦◆", " ◆▦▦◆ ")
);
});

@@ -46,6 +47,6 @@

imgSrc
.crop(0, 0, 2, 5)
.getJGDSync()
.should.be.sameJGD(mkJGD(" ", " ◆", "◆▦", " ◆", " "));
expectToBeJGD(
imgSrc.crop(0, 0, 2, 5).getJGDSync(),
mkJGD(" ", " ◆", "◆▦", " ◆", " ")
);
});

@@ -56,6 +57,6 @@

imgSrc
.crop(4, 0, 2, 5)
.getJGDSync()
.should.be.sameJGD(mkJGD(" ", "◆ ", "▦◆", "◆ ", " "));
expectToBeJGD(
imgSrc.crop(4, 0, 2, 5).getJGDSync(),
mkJGD(" ", "◆ ", "▦◆", "◆ ", " ")
);
});

@@ -66,7 +67,7 @@

imgSrc
.crop(2, 0, 2, 5)
.getJGDSync()
.should.be.sameJGD(mkJGD("◆◆", "▦▦", "▦▦", "▦▦", "◆◆"));
expectToBeJGD(
imgSrc.crop(2, 0, 2, 5).getJGDSync(),
mkJGD("◆◆", "▦▦", "▦▦", "▦▦", "◆◆")
);
});
});
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