Use the Hackathon EAV cleaner module for this. After installation you can use the command eav:media:remove-unused
Also you can do it by installing the module below and running these commands.
composer require ekouk/imagecleaner “dev-master”
Run in check only mode which will report the number and size in Mb of unused images.
Then run this command to delete the files.
bin/magento ekouk:cleanimages -d