image_hash 1.0.9 copy "image_hash: ^1.0.9" to clipboard
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');
}
5
likes
145
points
107
downloads

Publisher

verified publisherlpkt.cn

Weekly Downloads

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 content-based image retrieval.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

image

More

Packages that depend on image_hash