How to use the imagehash.hash function in ImageHash

To help you get started, we’ve selected a few ImageHash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cbanack / comic-vine-scraper / src / py / utils / automatcher.py View on Github external
def __get_local_hash(book):
   ''' 
   Gets the image hash for the cover of the give ComicBook object.  Returns
   None if the cover image was empty or couldn't be hashed for any reason.
   '''   
   hash = None # matches nothing
   try:
      image = book.create_image_of_page(0) if book else None;
      if image:
         image = utils.strip_back_cover(image)
         hash = imagehash.hash(image)
   finally:
      if "image" in locals() and image: image.Dispose()
   return hash
github cbanack / comic-vine-scraper / src / py / utils / automatcher.py View on Github external
def __get_remote_hash(ref):
   ''' 
   Gets the image hash for a remote comic book resource.  This resource
   can be a SeriesRef (hashes series art), an IssueRef (hashes the 
   first issue cover) or a URL to an image on the web.
   
   Returns None if the ref led to an image that was empty or 
   couldn't be hashed for any reason.
   '''  
   hash = None # matches nothing
   try:
      image = db.query_image(ref) if ref else None
      if image:
         image = utils.strip_back_cover(image)
         hash = imagehash.hash(image)
   finally:
      if "image" in locals() and image: image.Dispose()
   return hash

ImageHash

Image Hashing library

BSD-2-Clause
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis

Similar packages