trimesh icon indicating copy to clipboard operation
trimesh copied to clipboard

add texture from image to shape

Open pvnieo opened this issue 3 years ago • 6 comments

Hi,

I have a 3D shape loaded from an .off file, and I have an image load as a PIL image.

I want to add this image as a texture to the mesh but I can't figure out how to do it. I did the following manipulation, but when I show the mesh, the texture is not applied.

import trimesh
from PIL import Image

im = Image.open("image.png")
m = trimesh.load("mesh.off", process=False)

tex = trimesh.visual.TextureVisuals(image=im)
m.visual.texture = tex

m.show()

How can I do this? Thank you in advance.

pvnieo avatar Nov 21 '20 22:11 pvnieo