Setup: Blender 2.82
I have multiple images that i take from a CNN and i want to put on planes
I tried like this:
mat = bpy.data.materials.new(name='test')
mat.use_nodes = True
bsdf = mat.node_tree.nodes["Principled BSDF"]
texImage = mat.node_tree.nodes.new('ShaderNodeTexImage')
texImage.image = bpy.data.images.load(image)
mat.node_tree.links.new(bsdf.inputs['Base Color'], texImage.outputs['Color'])
bpy.ops.mesh.primitive_plane_add(location=(k, y, l ))
bpy.context.active_object.name = 'plane'
plane = bpy.context.object
if plane.data.materials:
plane.data.materials[0] = mat
else:
plane.data.materials.append(mat)
How can the image be loaded from an numpy array of pixels ?
Additionally to this, does the image added to the plane needs to respect some format?