How to Create a Perceptual Image Hash using Python

One of the best ways to track down duplicates of a copyright image is by using perceptual hashes — and to do that, you need to create these hashes in the first place. Using the complementary Python code below, you can easily take advantage of a perceptual hash generation API with simple request parameters. Simply include your image file (formats like PNG, JPG supported) in your request, (optionally) specify a normal, basic or advanced “recognitionmode” setting, and call the function.

First, run this command to install the Python SDK:

Next, add the imports and call the function:

To complete your API call for free, register a free account on our website and include your free-tier API key in your request. That’s all there is to it — no more code required!

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.