A PHP library for generating perceptual image hashes to detect similar or duplicate images.
Jenssegers/ImageHash is a PHP library that generates perceptual hashes from images to enable similarity detection rather than exact matching. It produces similar fingerprints for visually alike images, making it useful for identifying duplicates, finding similar images, or detecting copyright violations. The library supports multiple hash algorithms and works with PHP's GD or Imagick extensions.
PHP developers working on applications that require image comparison, such as content management systems, digital asset libraries, or platforms needing duplicate image detection. It's also suitable for developers implementing copyright violation checks or image similarity search features.
Developers choose this library because it provides a simple, efficient way to compare images perceptually with multiple hash implementations (AverageHash, DifferenceHash, BlockHash, PerceptualHash) and flexible hash storage options. Its focus on practical use cases like duplicate detection, combined with support for Hamming distance comparison and easy reconstruction from stored values, makes it a versatile tool for image analysis tasks.
🌄 Perceptual image hashing for PHP
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports four perceptual hashing implementations, including DifferenceHash recommended for general use, allowing developers to balance speed and accuracy based on specific needs.
Outputs hashes in hexadecimal, binary, integer, or byte formats, enabling easy database storage and retrieval as demonstrated in the usage examples.
Provides fromHex, fromBin, and fromInt methods to recreate Hash objects from stored values, simplifying persistence and comparison in applications.
Works with both GD and Imagick PHP extensions, offering flexibility in image processing backends without locking users into a single dependency.
The library is in version 0.x with explicit warnings about potential breaking changes between releases, making it risky for production use without strict version locking.
Two of the four hashing methods, BlockHash and PerceptualHash, are marked as 'Still under development,' limiting their reliability and usefulness in critical applications.
Requires GD or Imagick, which may not be available in all server setups, adding complexity for deployment in constrained or legacy environments.
Focuses solely on perceptual hashing algorithms, so it's not suitable for cryptographic hashing or more sophisticated image analysis tasks like facial recognition.