videohash icon indicating copy to clipboard operation
videohash copied to clipboard

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

Open albertopasqualetto opened this issue 1 year ago • 12 comments

Pillow's release notes

PR also done in your other project imagedominantcolor.

albertopasqualetto avatar Aug 07 '23 22:08 albertopasqualetto

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

ShareBugreports avatar Oct 30 '23 15:10 ShareBugreports

Please merge it. :)

SvenHerr avatar Nov 05 '23 17:11 SvenHerr

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

SvenHerr avatar Nov 05 '23 17:11 SvenHerr

@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).

albertopasqualetto avatar Nov 06 '23 07:11 albertopasqualetto

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

SvenHerr avatar Nov 06 '23 11:11 SvenHerr

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 avatar Nov 13 '23 03:11 moracabanas

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 avatar Nov 29 '23 18:11 moracabanas

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

moracabanas avatar Nov 29 '23 18:11 moracabanas

@moracabanas thanks for the guide waiting for merges!

albertopasqualetto avatar Nov 29 '23 20:11 albertopasqualetto

@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.

Demmenie avatar Dec 26 '23 00:12 Demmenie

I think the developer is not maintaining this package anymore

AlistairLR112 avatar Mar 05 '24 15:03 AlistairLR112

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.

albertopasqualetto avatar Mar 06 '24 23:03 albertopasqualetto