Java fork of Resemble.js javascript library.
- Compare two images giving a mismatch score
- create an image with a configurable visual difference
- Preprocess util to crop background, resize, fit.
You can run the TestApp.java
file or:
File imgFile1 = new File("1.jpg");
File imgFile2 = new File("2.jpg");
BufferedImage img1 = ImageUtils.readImage(imgFile1);
BufferedImage img2 = ImageUtils.readImage(imgFile2);
//ignore antialiasing between two images (different qualities for example)
ResembleAnalysisOptions options = ResembleAnaylsisOptionsTemplates.ignoringAntialiasing();
ResembleAnalysisResults results = new ResembleAnalysis(options).analyseImages(img1, img2);
ResembleParserData dataResult = ResembleParser.parse(results.getOutputImage());
System.out.println(String.format("File 1: '%s'\n" +
"File 2: '%s'\n\n" +
"Info: %s\n\n" +
"Output image:\n%s\n\n" +
"Options:\n%s\n\n" +
"Mismatch percentage: %.2f %%\n" +
"Analysis time: %d miliseconds\n" +
"Difference bounds: %s",
imgFile1, imgFile2, dataResult, results.getOutputImage(), options,
results.getMismatchPercentage(), results.getAnalysisTime().toMillis(),
results.getDiffBounds()));
The image used in the comparison example was created by Daniel Rajendran
- Resize the two images before comparing them (allowing different size and quality images comparison)
- Add templating for comparison using the thresholds available the ResembleJS Demo page http://rsmbl.github.io/Resemble.js/
- Make crop threshold customizable
- Crop the image removing the white background