diff_image 0.1.1 copy "diff_image: ^0.1.1" to clipboard
diff_image: ^0.1.1 copied to clipboard

outdated

A package to get the difference between two images. Currently only supports images from URLs.

diff_image #

A Dart Package to get the % difference between two images of the same width and height.

diff_image is a Dart version of this with changes on visualization and , you guessed it, the language.

Example #

A simple usage example:

import 'package:diff_image/diff_image.dart';

final FIRST_IMAGE = 'https://raw.githubusercontent.com/nicolashahn/diffimg/master/images/mario-circle-cs.png';
final SECOND_IMAGE = 'https://raw.githubusercontent.com/nicolashahn/diffimg/master/images/mario-circle-node.png';

void foo() async{
  try{
      var diff = await DiffImage.compareFromUrl(FIRST_IMAGE, SECOND_IMAGE);
      print('The difference between images is: $diff %');
  } catch(e){
      print(e);
  }
}

main() {
  foo();
}

A more detailed example can be found here

Features #

  1. Currently there is support only for images from the web (urls)
  2. The compareFromUrl definition is:
     static Future<num> compareFromUrl(
           firstImgSrc, secondImgSrc,
           {ignoreAlpha=true, asPercentage=true, saveDiff=false}
           ) async{...}

where:

  • ignoreAlpha allows to decide whether to take alpha from RGBA into account for the calculation
  • asPercentage set the format of the output (as percentage or between 0-1)
  • saveDiff save a png showing the differences between [firstImgSrc] and [secondImgSrc] (currently not available on Dart Web)

Sample Results #

First Image #

flutter_logo

Second Image #

android_logo

Difference Percentage #

With Alpha : 35.67169421487167 %

Without Alpha : 34.83905183744361 %

Difference Image #

DiffImg

Suggestions and bugs #

Please file feature requests, suggestions and bugs at the issue tracker.

18
likes
40
pub points
28%
popularity

Publisher

unverified uploader

A package to get the difference between two images. Currently only supports images from URLs.

Repository (GitHub)
View/report issues

License

GPL-3.0 (LICENSE)

Dependencies

http, image

More

Packages that depend on diff_image