Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jajbshjahavahh
GitHub Repository: jajbshjahavahh/Gojo-Satoru
Path: blob/master/node_modules/@jimp/tiff/test/tiff.test.js
2593 views
1
import { Jimp, getTestDir } from '@jimp/test-utils';
2
import configure from '@jimp/custom';
3
4
import tiff from '../src';
5
6
const jimp = configure({ types: [tiff] }, Jimp);
7
8
describe('TIFF', () => {
9
const imagesDir = getTestDir(__dirname) + '/images';
10
11
it('load TIFF', async () => {
12
const image = await jimp.read(imagesDir + '/rgb.tiff');
13
14
image.getPixelColor(10, 10).should.be.equal(0xa4988bff);
15
image.getPixelColor(220, 190).should.be.equal(0xe0d7ddff);
16
image.getPixelColor(350, 130).should.be.equal(0x565433ff);
17
});
18
19
const simpleJGD = {
20
width: 3,
21
height: 3,
22
data: [
23
0xff0000ff,
24
0xff0080ff,
25
0xff00ffff,
26
0xff0080ff,
27
0xff00ffff,
28
0x8000ffff,
29
0xff00ffff,
30
0x8000ffff,
31
0x0000ffff
32
]
33
};
34
35
it('export TIFF', async () => {
36
const image = await jimp.read(simpleJGD);
37
const buffer = await image.getBufferAsync('image/tiff');
38
39
buffer.toString().should.match(/^MM\u0000*\u0000/);
40
});
41
});
42
43