# How to get if the image texture node material lost image path with python?

I was wondering if there was a way to get the simple information. For example on the broadcast node in this case it has lost the image link, how can I get this information in python? This is the classic situation:

I would like to understand how this information can be obtained through blender bees if possible. And if there is also information about the path of the folder to the currently lost file

This could be useful, I should have found the method that checks the state of the images.

To check if the image in the node are "Purple":

import bpy

ob = bpy.context.object
mat=ob.active_material

for n in mat.node_tree.nodes:
if n.type=='TEX_IMAGE':
img=n.image
for i in bpy.data.images:
if i == img:
print(i.has_data)

###if your material are lost/purple return true


This will go directly to material the node, but you can check it directly in bpy.data.images

for i in bpy.data.images:
if not i.has_data:
print('Purple/lost image find: ' + i.name)
##print a list with lost image file


So I suppose this is my answer

According to the documentation, the has_data property tells whether the image data is loaded into memory. So using this would work if all images are previously loaded to memory. But generally, this has nothing to do with whether the image file has been packed to the current .blend file or not. I would correct Noob Cat answer with the following code:

import bpy

ob = bpy.context.object
mat=ob.active_material

for n in mat.node_tree.nodes:
if n.type=='TEX_IMAGE':
img=n.image  # Already has type 'bpy.types.Image', so no need to access it via bpy.data.images[img.name]
if img is not None and img.packed_file is None:
print("Image %s is missing" % img.name)