bpy_extras submodule (bpy_extras.image_utils)

bpy_extras.image_utils.load_image(imagepath, dirname='', place_holder=False, recursive=False, ncase_cmp=True, convert_callback=None, verbose=False)

Return an image from the file path with options to search multiple paths and return a placeholder if its not found.

Parameters:
  • filepath (string) – The image filename If a path precedes it, this will be searched as well.
  • dirname (string) – is the directory where the image may be located - any file at the end will be ignored.
  • place_holder (bool) – if True a new place holder image will be created. this is usefull so later you can relink the image to its original data.
  • recursive (bool) – If True, directories will be recursivly searched. Be carefull with this if you have files in your root directory because it may take a long time.
  • ncase_cmp (bool) – on non windows systems, find the correct case for the file.
  • convert_callback (function) – a function that takes an existing path and returns a new one. Use this when loading image formats blender may not support, the CONVERT_CALLBACK can take the path for a GIF (for example), convert it to a PNG and return the PNG’s path. For formats blender can read, simply return the path that is given.
Returns:

an image or None

Return type:

Image

Previous topic

bpy_extras submodule (bpy_extras.io_utils)

Next topic

bpy_extras submodule (bpy_extras.mesh_utils)