Jagdish Pal
Jagdish Pal

Reputation: 33

Is there any way by which I can apply imagehash function in online images in Python

I want to get fingerprints for images with the help of the imagehash function in Python but in order to apply

hash = imagehash.average_hash(Image.open(path))

the image needs to be in storage. Is there any way from which by just giving the image URL I can get the fingerprint of the image?

Upvotes: 1

Views: 417

Answers (1)

enzo
enzo

Reputation: 11496

You can use requests:

url = 'https://commons.wikimedia.org/wiki/File:Example.png'

import requests
response = requests.get(url, stream=True)
ihash = imagehash.average_hash(Image.open(response.raw))

Upvotes: 1

Related Questions