I downloaded a model and found some images that I don't think are needed, but the images do not show up in orphan data so something is using them. How do I find out what is using the image(s).
Via a script.
An image, like a mesh, world, material ... in blender is an ID object. Given the image is our ID object of interest Run over all the ID objects in the blend and list and report any where
ob.user_of_id(ID) is > 0
import bpy from bpy.types import bpy_prop_collection def search(ID): def users(col): ret = tuple(repr(o) for o in col if o.user_of_id(ID)) return ret if ret else None return filter(None, ( users(getattr(bpy.data, p)) for p in dir(bpy.data) if isinstance( getattr(bpy.data, p, None), bpy_prop_collection ) ) ) img = bpy.data.images #img = bpy.data.images['Foo'] # an image named Foo # report print(repr(img)) print("Users:", img.users) for users in search(img): print(users)
Test run. Image used in material, "Material", node group "NodeGroup", reference image empty "Empty", texture "Texture" and world "World".
bpy.data.images['Screenshot from 2021-06-17 17-17-47.png'] Users: 5 ("bpy.data.materials['Material']",) ("bpy.data.node_groups['NodeGroup']",) ("bpy.data.objects['Empty']",) ("bpy.data.textures['Texture']",) ("bpy.data.worlds['World']",)
.. or users of context object, edit to
img = bpy.context.object
bpy.data.objects['Cube'] Users: 2 ("bpy.data.collections['Collection 1']",) ("bpy.data.scenes['Scene']",)