code: def computeImgSignature(image_data):
      
      parser = PIL.ImageFile.Parser()
      parser.feed(image_data)
      img = parser.close()
      target_size = (__class__.IMG_SIG_SIZE, __class__.IMG_SIG_SIZE)
      img.thumbnail(target_size, PIL.Image.BICUBIC)
      if img.size != target_size:
        logging.getLogger("Cover").debug("Non square thumbnail after resize to %ux%u, unable to compute signature" % target_size)
        return None
      img = img.convert(mode="RGB")
      pixels = img.getdata()
      pixel_count = target_size[0] * target_size[1]
      color_count = 3
      r = bitarray.bitarray(pixel_count * color_count)
      r.setall(False)
      for ic in range(color_count):
        mean = sum(p[ic] for p in pixels) // pixel_count
        for ip, p in enumerate(pixels):
          if p[ic] > mean:
            r[pixel_count * ic + ip] = True
      return r
docs: Calculate an image signature.
  
      This is similar to ahash but uses 3 colors components
      See: https://github.com/JohannesBuchner/imagehash/blob/4.0/imagehash/__init__.py#L125