akamhy / videohash

Near Duplicate Video Detection (Perceptual Video Hashing) - Get a 64-bit comparable hash-value for any video.
https://pypi.org/project/videohash
MIT License
281 stars 46 forks source link

Image.Resampling.LANCZOS instead of Image.ANTIALIAS deprecated in Pillow 10 #109

Open albertopasqualetto opened 1 year ago

albertopasqualetto commented 1 year ago

Pillow's release notes

PR also done in your other project imagedominantcolor.

ShareBugreports commented 11 months ago

I needed to fix "imagedominantcolor/dominantcolor.py", line 20 as well.

SvenHerr commented 11 months ago

Please merge it. :)

SvenHerr commented 11 months ago

how could we get around this until this is merged ? @albertopasqualetto

albertopasqualetto commented 11 months ago

@SvenHerr last time I used it, it was deprecated, but still working. Are things changed now? Anyway you can basically use my github fork instead of the library. It will remain as is until PR's merge. Or you can apply the patch by yourself (go see the PR).

SvenHerr commented 11 months ago

Yes. Its not working anymore. I forked it and did the changes myself. Than installed as dev

moracabanas commented 10 months ago

how could we get around this until this is merged ? @albertopasqualetto

As a workaround I've manage to install the correct branch from @albertopasqualetto PR with this:

pip install git+https://github.com/albertopasqualetto/videohash.git@pillow10

I will update my requirements when this is merged.

Please correct me if this is not recommended.

Thanks!

moracabanas commented 10 months ago

how could we get around this until this is merged ? @albertopasqualetto

As a workaround I've manage to install the correct branch from @albertopasqualetto PR with this:

pip install git+https://github.com/albertopasqualetto/videohash.git@pillow10

I will update my requirements when this is merged.

Please correct me if this is not recommended.

Thanks!

For some reason this method stopped working. pip still tells to me it is installing the right branch but in the end there is another PIL error

PIP output

pip install git+https://github.com/albertopasqualetto/videohash.git@pillow10

Collecting git+https://github.com/albertopasqualetto/videohash.git@pillow10
  Cloning https://github.com/albertopasqualetto/videohash.git (to revision pillow10) to /tmp/pip-req-build-2h4lcsbf
  Running command git clone --filter=blob:none --quiet https://github.com/albertopasqualetto/videohash.git /tmp/pip-req-build-2h4lcsbf
  Running command git checkout -b pillow10 --track origin/pillow10
  Switched to a new branch 'pillow10'
  Branch 'pillow10' set up to track remote branch 'pillow10' from 'origin'.
  Resolved https://github.com/albertopasqualetto/videohash.git to commit ea7635c1410ff6c593760648ae3d1dae911e77b5
  Preparing metadata (setup.py) ... done
Requirement already satisfied: Pillow in ./.venv/lib/python3.10/site-packages (from videohash==3.0.1) (10.0.1)
Requirement already satisfied: ImageHash in ./.venv/lib/python3.10/site-packages (from videohash==3.0.1) (4.3.1)
Requirement already satisfied: imagedominantcolor in ./.venv/lib/python3.10/site-packages (from videohash==3.0.1) (1.0.1)
Collecting yt-dlp (from videohash==3.0.1)
  Downloading yt_dlp-2023.11.16-py2.py3-none-any.whl.metadata (160 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 160.5/160.5 kB 1.9 MB/s eta 0:00:00
Requirement already satisfied: PyWavelets in ./.venv/lib/python3.10/site-packages (from ImageHash->videohash==3.0.1) (1.4.1)
Requirement already satisfied: numpy in ./.venv/lib/python3.10/site-packages (from ImageHash->videohash==3.0.1) (1.26.0)
Requirement already satisfied: scipy in ./.venv/lib/python3.10/site-packages (from ImageHash->videohash==3.0.1) (1.11.3)
Requirement already satisfied: mutagen in ./.venv/lib/python3.10/site-packages (from yt-dlp->videohash==3.0.1) (1.47.0)
Requirement already satisfied: pycryptodomex in ./.venv/lib/python3.10/site-packages (from yt-dlp->videohash==3.0.1) (3.19.0)
Requirement already satisfied: websockets in ./.venv/lib/python3.10/site-packages (from yt-dlp->videohash==3.0.1) (11.0.3)
Requirement already satisfied: certifi in ./.venv/lib/python3.10/site-packages (from yt-dlp->videohash==3.0.1) (2023.7.22)
Requirement already satisfied: requests<3,>=2.31.0 in ./.venv/lib/python3.10/site-packages (from yt-dlp->videohash==3.0.1) (2.31.0)
Requirement already satisfied: urllib3<3,>=1.26.17 in ./.venv/lib/python3.10/site-packages (from yt-dlp->videohash==3.0.1) (2.0.4)
Requirement already satisfied: brotli in ./.venv/lib/python3.10/site-packages (from yt-dlp->videohash==3.0.1) (1.1.0)
Requirement already satisfied: charset-normalizer<4,>=2 in ./.venv/lib/python3.10/site-packages (from requests<3,>=2.31.0->yt-dlp->videohash==3.0.1) (3.2.0)
Requirement already satisfied: idna<4,>=2.5 in ./.venv/lib/python3.10/site-packages (from requests<3,>=2.31.0->yt-dlp->videohash==3.0.1) (3.4)
Downloading yt_dlp-2023.11.16-py2.py3-none-any.whl (3.1 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.1/3.1 MB 19.7 MB/s eta 0:00:00
Building wheels for collected packages: videohash
  Building wheel for videohash (setup.py) ... done
  Created wheel for videohash: filename=videohash-3.0.1-py3-none-any.whl size=23734 sha256=6a4e09db2bc0b06b11888fb87c52c6b61f27a8a819b4a6dac42c22f6a3d24212
  Stored in directory: /tmp/pip-ephem-wheel-cache-rwb0ejo4/wheels/e7/73/71/be3630faf5572cc635928e672e28035e91122bcaabb6c24dc1
Successfully built videohash
Installing collected packages: yt-dlp, videohash
Successfully installed videohash-3.0.1 yt-dlp-2023.11.16

Error traze

....venv/lib/python3.10/site-packages/imagedominantcolor/dominantcolor.py", line 20, in __init__
    (DominantColor.resize_value, DominantColor.resize_value), Image.ANTIALIAS
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
moracabanas commented 10 months ago

Solution to https://github.com/akamhy/videohash/pull/109#issuecomment-1832478251

As mentioned pillow dependencies are affected in imagedominantcolor you also need to patch first that python dependecy as follows:

pip install git+https://github.com/albertopasqualetto/imagedominantcolor@pillow10

and then

pip install git+https://github.com/albertopasqualetto/videohash.git@pillow10

albertopasqualetto commented 10 months ago

@moracabanas thanks for the guide waiting for merges!

Demmenie commented 9 months ago

@akamhy, please merge this; pillow.ANTIALIAS is deprecated and no longer works in pillow>=10.0.0. Older versions of pillow have multiple known DoS vulnerabilities.

AlistairLR112 commented 7 months ago

I think the developer is not maintaining this package anymore

albertopasqualetto commented 7 months ago

I think the developer is not maintaining this package anymore

It seems so, maybe someone could write a mail to the mantainer in order to decide what to do.

In the meanwhile you can use my fork as explained above.