Error exporting mesh (obj/ply) - Your MeshLab version has not plugin to save file format
MichaelRabinovich opened this issue · comments
I'm trying to run the following code:
ms = pymesh.MeshSet()
ms.load_new_mesh("path_to_glb.glb")
ms.save_current_mesh("path_to_new_obj.obj")
And I get the following error:
_Traceback (most recent call last):
File "<string>", line 1, in <module>
pymeshlab.pmeshlab.PyMeshLabException: Image PATH/texture_0 cannot be saved. Your MeshLab version has not plugin to save file format._
I am however able to convert it using Meshlab GUI (not the python repo).
The pymeshlab version is the current one, I just installed via pip today.
I have the same issue on Windows only.
@MichaelRabinovich Did you find a solution to your problem?
Could you please provide a reproducible example?
@alemuntoni
model.zip
Find my input mesh above and the script I am using as below:
`
import pymeshlab as pml
ms = pml.MeshSet()
ms.load_new_mesh(<input_mesh_path>)
ms.apply_filter('meshing_tri_to_quad_by_4_8_subdivision')
ms.load_new_mesh(<input_mesh_path>)
ms.apply_filter('transfer_texture_to_color_per_vertex', sourcemesh=0, targetmesh=1)
ms.save_current_mesh(<output_mesh_path>, save_textures=True)
`
The script should transfer the vertex color from trimesh to the quadmesh version of the same model.
Could you please provide a reproducible example?
I can reproduce @MichaelRabinovich 's error with his code using @ashutoshmishra1014 's model file and also with some of my own.
I have an idea why the issue is happening if it can help debugging.
In the error message, you can see the texture it is trying to save doesn't have a file extension. Same if you look in the .mtl file it manages to create, it's just "texture_0" no file extension associated. I'm guessing this is happening since .glb/.gltf stores the textures internally so there's likely no file extension when the files are getting read.
I don't have a real work around. I can get the texture to export by running the image save function and giving it my own name with a file extension:
ms.current_mesh().texture(0).save("myfilename.png")
But the .mtl file is still wrong and would need to be manually fixed. I tried to change the name of the texture to add a file extension using the textures dictionary but I haven't managed to make it work yet.