I need to import a bunch of models which use .dds textures, which are not supported by Cycles, but they are supported by Blender. I can open such a .dds in the image editor, and press F3(Save image as) to save it as a perfectly functional .png file.
However when I try to do this through Python, it fails without a useful error message, and no new file gets created.
Here is my code:
# Set current panel to Image/UV Editor area = bpy.context.area area.type = 'IMAGE_EDITOR' for i in bpy.data.images: area.spaces.active.image = i newPath = i.filepath.replace("dds", "png") bpy.ops.image.save_as(save_as_render=False, filepath=newPath, relative_path=True)
Which will throw this useless error:
Couldn't save picture. D:\Path\FileName.png: No error Error: Could not write image: No error Traceback (most recent call last): File "D:\ProjectPath\TexConvertTest.blend\Text", line 19, in <module> File "C:\3D\Blender\blender-2.79-windows64\2.79\scripts\modules\bpy\ops.py", line 189, in __call__ ret = op_call(self.idname_py(), None, kw) RuntimeError: Error: Could not write image: No error
I tried running it with admin priviliges, but no difference. Any other suggestions would be appreciated!