I am trying to save a packed image (generated via texture painting). To do this, I call unpack()
, which should save the image, but I can't find it on my hard drive (Linux, blender 2.73). Does there exist a way for further customization (such as setting the image file format, file name, directory to save into, ..)?
1 Answer
The docs reference unpack
Given an image with the super descriptive name 'Untitled':
>>> bpy.ops.image.unpack(id='Untitled')
Warning: AutoPack is enabled, so image will be packed again on file save
Info: Saved packed file to: /home/zeffii/Downloads/textures/dances_packed.png
{'FINISHED'}
If you look in console you'll see where it saved to.
But it is possible for certain to use plain old .save()
too. Opening a .blend where the image is packed I did
bpy.data.images['Untitled'].filepath = '/home/zeffii/Desktop/some_name.png'
bpy.data.images['Untitled'].save()
And it stored straight to desktop
Things I don't know
How to save as a different file type, and how to force a different save directory for the unpack command.
-
$\begingroup$ Worth noting that you can call unpack without resorting to
bpy.ops
-bpy.data.images["Untitled"].unpack()
- See: blender.org/api/blender_python_api_2_74_release/… You can set the filepath, then callunpack
$\endgroup$ Apr 29, 2015 at 14:02 -
$\begingroup$ cool. will work that into the answer. Thanks again! $\endgroup$– zeffiiApr 29, 2015 at 14:08
-
$\begingroup$ @ideasman42 why might I get the error
RuntimeError: Error: Image not packed
when running image.unpack() , the image is listed in datablock outliner in packed_files.. $\endgroup$– zeffiiApr 29, 2015 at 14:22 -
$\begingroup$ I called unpack directly on an Image instance, didn't use ops. There was no Info issued. Where's the catch? $\endgroup$ Apr 29, 2015 at 16:12
-
$\begingroup$ @zeffii, not sure, maybe this should be a bug report. $\endgroup$ Apr 29, 2015 at 22:03