Image hashing using d-hash, p-hash or a-hash

Hello plugin developers.

I am looking for a way to calculate image hashes from images in my database.
I have looked for public API’s that provides this, but I have not found anything ready to use.

I have found this github repo https://github.com/coenm/ImageHash#api which seems to have anything I need, but I need it to run on a server where it can accept image URL’s and respond with a chosen hash value.

Anyone know if this is achieveable as a plugin?
Or would I need to set it up on a dedicated server serving this API endpoint?

My usecases:

  • Check if an image is already uploaded in a primary database, link to it instead of hosting a duplicate.
  • check for copyright infringement on proprietary images.
  • Find related images that has a short hamming distance between hashes.

Best regards,
Asbjørn.