Closed linhandev closed 2 years ago
I don't understand why you would input a md5 hash into a perceptual hashing library. Is the point to operate on byte strings? If so, should one not reuse the existing functions and call them in this static function.
I don't think I understood this part
If so, should one not reuse the existing functions and call them in this static function.
My use case for this was, I generated hashes with this lib and also others. As the ImageHash class has defined subtract to calculate the distance, and also to make the hashes more "uniform", (supporting the the same ops so I can easily loop through them and perform the same ops), I wanted to create ImageHash objects from the digest generated from other libs.
My consideration of using static method was this is likely not a common usecase, and putting these code in init may have negative performance impact?
Just a thought, just close this if you think it's out of scope.
I think you can treat such hashes homogeneously by calling hex_to_hash (or hex_to_flathash).
With this addition we can do
This way it's easy to create ImageHash from digest generated by other hash libs. Makes processing hashes more uniform.