Checking manually for just Commons, where there are 151K GIFs, that's 468 potentially affected files in the image table and 121 files in the oldimage table (with a decent amount of overlap, I'm sure). Should be quick to purge once the list has been generated for every wiki.