image_hash 1.0.9
image_hash: ^1.0.9 copied to clipboard
This package allows you to generate hash values from images and compare them to determine similarity, making it useful for tasks like finding duplicate or similar images, image recognition, and conten [...]
example/image_hash_example.dart
import 'package:image_hash/src/enums.dart';
void main() async {
// Use perceptual hash to compare images
final hash1 = await HashFn.perceptual.hashFile('test/fixtures/origin.png');
final hash2 = await HashFn.perceptual.hashFile('test/fixtures/edited2.jpg');
// 0 means the same image, higher value means more different.
// You must use the same hash function to compare images
final distance = hash1.distance(hash2);
final similarity = hash1.similarity(hash2);
print('$hash1 <=> $hash2, Distance: $distance, Similarity: $similarity');
}