Path: blob/master/node_modules/@jimp/tiff/test/tiff.test.js
2593 views
import { Jimp, getTestDir } from '@jimp/test-utils';1import configure from '@jimp/custom';23import tiff from '../src';45const jimp = configure({ types: [tiff] }, Jimp);67describe('TIFF', () => {8const imagesDir = getTestDir(__dirname) + '/images';910it('load TIFF', async () => {11const image = await jimp.read(imagesDir + '/rgb.tiff');1213image.getPixelColor(10, 10).should.be.equal(0xa4988bff);14image.getPixelColor(220, 190).should.be.equal(0xe0d7ddff);15image.getPixelColor(350, 130).should.be.equal(0x565433ff);16});1718const simpleJGD = {19width: 3,20height: 3,21data: [220xff0000ff,230xff0080ff,240xff00ffff,250xff0080ff,260xff00ffff,270x8000ffff,280xff00ffff,290x8000ffff,300x0000ffff31]32};3334it('export TIFF', async () => {35const image = await jimp.read(simpleJGD);36const buffer = await image.getBufferAsync('image/tiff');3738buffer.toString().should.match(/^MM\u0000*\u0000/);39});40});414243