3.5.3 • Published 4 years ago

pixdiff-zone v3.5.3

Weekly downloads
2
License
MIT
Repository
-
Last release
4 years ago

Pixdiff

Pixdiff is an image comparison that detect pixel difference between 2 images. This library is heavely inspired by pixelmatch. 90% of the code is coming from this library converted to Typescript. Also some new feature was added to determine some differences in the images by zones instead of pixel. See the example, the red pixel are the pixel differences, the yellow pixel the anti aliasing and the green rectangle the zone.

screenshot-example

import { pixdiff } from 'pixdiff-zone';
import { readFile, writeFile } from 'fs-extra';

async function diffPng() {
    const actual = await readFile('img1.png');
    const expected = await readFile('img2.png');
    const rawActual = PNG.sync.read(actual);
    const rawExpected = PNG.sync.read(expected);

    const { width, height } = rawActual;
    const diffImage = new PNG({ width, height });

    const { diff, zones } = pixdiff(
        rawActual,
        rawExpected,
        diffImage,
    );

    if (diff) {
        const buffer = PNG.sync.write(diffImage, { colorType: 6 });
        writeFile('diff.png', buffer);
    }
}
diffPng();
3.5.3

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.3.1

4 years ago

2.2.4-alpha.0

4 years ago

1.0.0-alpha.0

4 years ago

0.10.5

4 years ago

0.10.0

4 years ago

0.9.0

5 years ago

0.8.0

5 years ago

0.7.8

5 years ago

0.7.6

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.2

5 years ago

0.2.0

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago