Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@jimp/plugin-threshold/test/threshold.test.js
1126 views
1
import { Jimp, getTestDir } from '@jimp/test-utils';
2
import configure from '@jimp/custom';
3
import jpeg from '@jimp/jpeg';
4
import color from '@jimp/plugin-color';
5
import resize from '@jimp/plugin-resize';
6
7
import threshold from '../src';
8
9
const jimp = configure(
10
{ types: [jpeg], plugins: [threshold, color, resize] },
11
Jimp
12
);
13
14
describe('Threshold', function() {
15
this.timeout(15000);
16
17
it('defines default threshold for lighter backgrounds', async () => {
18
const expectedImage = await jimp.read(
19
getTestDir(__dirname) + '/images/hands_mx200_rp255.jpg'
20
);
21
const testImage = await jimp.read(
22
getTestDir(__dirname) + '/images/hands.jpg'
23
);
24
25
testImage
26
.threshold({ max: 200, replace: 255 })
27
.hash()
28
.should.be.equal(expectedImage.hash());
29
});
30
});
31
32