Basic Image Comparison
Compare sample images using different perceptual hashing algorithms. Select images and an algorithm to see how similar they are.
Choose Algorithm
First Image
Second Image
🔍
Select Images to Compare
Choose two images and an algorithm to see their similarity comparison.
Code Example
import 'package:dart_imagehash/dart_imagehash.dart';
// Load images
final image1 = decodeImage(File('image1.jpg').readAsBytesSync())!;
final image2 = decodeImage(File('image2.jpg').readAsBytesSync())!;
// Calculate ahash hash
final hash1 = ImageHasher.averageHash(image1);
final hash2 = ImageHasher.averageHash(image2);
// Compare hashes
final distance = hash1 - hash2;
final similarity = 100.0 * (1.0 - (distance / hash1.bits.length));
print('Hash 1: $hash1');
print('Hash 2: $hash2');
print('Distance: $distance');
print('Similarity: ${similarity.toStringAsFixed(2)}%');
About the Sample Images
cat1.JPG
Original image used as the baseline for comparison.
cat1-modified.JPG
Modified version of cat1.JPG with cropping and added drawings.
cat2.JPG
Completely different image for comparison.