pixelmatch 1.0.1 copy "pixelmatch: ^1.0.1" to clipboard
pixelmatch: ^1.0.1 copied to clipboard

Diff images on CPU. Small, fast pixel-level image comparison library for e2e testing.

pixelmatch #

Diff images on CPU. Small, fast pixel-level image comparison library for e2e testing.

Features #

  • Pixel-by-pixel image comparison
  • Customizable threshold and colors for diff output
  • Anti-aliasing detection
  • Fast and memory efficient
expected actual diff
[] [] [diff]

Getting started #

Add library to your package and give Uint8List with RGBA canvas to it somehow.

Usage #

import 'package:pixelmatch/pixelmatch.dart';
import 'dart:typed_data';

void main() {
  // Prepare your image data as RGBA Uint8Lists
  final img1 = Uint8List(width * height * 4); // First image
  final img2 = Uint8List(width * height * 4); // Second image
  final diff = Uint8List(width * height * 4); // Output diff (or null)

  // Compare images
  final numDiffPixels = pixelmatch(img1, img2, diff, width, height, { 'threshold': 0.1 });

  print('Found $numDiffPixels different pixels');
}

Options

  • threshold (default: 0.1): Matching threshold (0 to 1); smaller is more sensitive
  • includeAA (default: false): Whether to skip anti-aliasing detection
  • alpha (default: 0.1): Opacity of original image in diff output
  • aaColor (default: [255, 255, 0]): Color of anti-aliased pixels in diff output
  • diffColor (default: [255, 0, 0]): Color of different pixels in diff output
  • diffColorAlt (default: null): Alternative color for dark on light differences
  • diffMask (default: false): Draw the diff over a transparent background

Additional information #

This is a Dart port of mapbox/pixelmatch.

1
likes
0
points
111
downloads

Publisher

unverified uploader

Weekly Downloads

Diff images on CPU. Small, fast pixel-level image comparison library for e2e testing.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on pixelmatch