Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

albertopasqualetto
Copy link

@albertopasqualetto albertopasqualetto commented Aug 7, 2023

Pillow's release notes

PR also done in your other project imagedominantcolor.

@ShareBugreports
Copy link

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

@SvenHerr
Copy link

SvenHerr commented Nov 5, 2023

Please merge it. :)

@SvenHerr
Copy link

SvenHerr commented Nov 5, 2023

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

@albertopasqualetto
Copy link
Author

albertopasqualetto commented Nov 6, 2023

@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
Copy link

SvenHerr commented Nov 6, 2023

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

@moracabanas
Copy link

moracabanas commented Nov 13, 2023

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
Copy link

moracabanas commented Nov 29, 2023

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
Copy link

Solution to #109 (comment)

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
Copy link
Author

@moracabanas thanks for the guide waiting for merges!

@Demmenie
Copy link

@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
Copy link

I think the developer is not maintaining this package anymore

@albertopasqualetto
Copy link
Author

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.

dale-wahl added a commit to dale-wahl/videohash that referenced this pull request Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants