Checking if the desired image type is supported in Blender

We can open an image/texture in Blender using the Python API by calling the…) operator, or directly through the blend data collection by calling the…) method.

However, if the desired image format is not supported by Blender, the code execution is not interrupted, Blender only prints an error message to the system console.

IMB_ibImageFromMemory: unknown file-format (c:\….f)

Before opening an image, we can check if its type is supported by Blender by checking its extension.

We can get a list of all image extensions supported by Blender from the bpy.path.extensions_image list:

Comparing the extension of the image with this list, we can determine if this type of image is supported in Blender:

5 1 vote
Article Rating
Notify of

0 Comment
Inline Feedbacks
View all comments