Anki-Connect add-on must be installed.
Install poppler for PDF conversions: https://poppler.freedesktop.org/.
Install pdf2image package with PIP.
Open Anki then run the script and enter the folder of your deck.
The script will create subdecks for the subfolders automatically and add the images.