Select all materials that share image file source? (really need help)

Not exactly sure how to put into words.

I have a model rip from a video game that is made of hundreds of materials – much more than needed – presumably because it is meant for a video game. It is made of hundreds of objects, each with one material, so I join all the objects together.

Normally (in my opinion), each image texture would have one or two materials, but each image is shared by tons of different materials.

I can look at the image source and type the name of the image file (in the case of the picture below, the name starts with 041a6680) in the outliner (top right) and see a list of every material that has that image, but the list is very long, and it can get tedious to manually click each material in the list, click “select” to highlight all polygons with that material, and then click “assign” at the end to assign all the selected polygons as one material.


Is there any way I can batch select every material that shares the same image file source at once and then assign them to the same material?
I can select multiple objects (meshes, lights, etc.) in the outliner, but not materials or other things. I hope it’s possible to do this.