JohannesBuchner / imagehash

A Python Perceptual Image Hashing Module
BSD 2-Clause "Simplified" License
3.19k stars 329 forks source link

Deprecated notice: numpy bool #136

Closed qathom closed 3 years ago

qathom commented 3 years ago

Hello,

Thanks for making this great library!

I'm receiving a deprecation notice saying that numpy.bool should be replaced in imagehash.py

Should the library be compatible with recent versions of numpy now?

Notice:

  /opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/imagehash.py:525: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    unassigned_pixels = numpy.full(pixels.shape, True, dtype=numpy.bool)
JohannesBuchner commented 3 years ago

It seems like replacing numpy.bool with bool would do the job. Would you submit a pull request?

qathom commented 3 years ago

Hi @JohannesBuchner Thanks for your prompt reply! Yes with pleasure. Please find my pull request: #137