Skip to content

convert hash string into <class 'imagehash.ImageHash'> #204

@kucingkembar

Description

@kucingkembar

sorry for stupid question again,
i got this code from your page

from PIL import Image
import imagehash
hash = imagehash.average_hash(Image.open('tests/data/imagehash.png'))
print(hash)
print(type(hash))# i edit this line
otherhash = imagehash.average_hash(Image.open('tests/data/peppers.png'))
print(otherhash)
print(hash == otherhash)
print(hash - otherhash)

as you can see, your hash can do some arithmetic,
i tried to convert from str : "ffd7918181c9ffff" or int : ffd7918181c9ffff
and both is fail ,
how to convert hash string into <class 'imagehash.ImageHash'>,
so i can do some arithmetic of it,

thank you,
have a nice day

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions