Skip to content

Conversation

@cvanelteren
Copy link

@cvanelteren cvanelteren commented Jan 29, 2026

This PR adds configurable hash methods for pytest-mpl’s hash comparison mode and switches perceptual hashing to use the ImageHash library. A new mpl-hash- method option is available via CLI, INI, and the mpl_image_compare decorator (hash_method=), with sha256 remaining the default for backward compatibility. When a non‑SHA method is selected, hashes are computed through ImageHash (e.g., phash, ahash, dhash, whash, colorhash, etc.), and those methods are restricted to raster formats (PNG) to avoid invalid usage with vector formats.The implementation removes the custom pHash code path and centralizes hash method validation and computation in the plugin. Documentation is updated to describe the new configuration option and to clarify that alternative hash methods are supported. A new test exercises hash_method="phash" to verify that perceptual hashes are generated correctly. The project now includes an optional hashes extra that installs ImageHash and its supporting dependencies for users who want perceptual hashes.

Closes #150 #146 #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant