1
$\begingroup$

In my script I create an image, generate the image and then save it like this:

image = bpy.data.images.new('my_image', width=1024, height=1024)
# other code that generates the image by baking onto a texture node ...
image.filepath_raw = '//outputs/my_image.tif'
image.file_format = 'TIFF'
image.save()

But when saving the image I would like to have control over those options:

screenshot of output options when saving from user interface

...which are available when saving from the user interface.

$\endgroup$

1 Answer 1

3
$\begingroup$

You can discover nearly all data paths from Blender GUI itself.

Set your mouse cursor over a field and a tooltip will appear:

enter image description here

You can also copy (part of) the path directly here:

enter image description here

Then you can use it (and test it) from the Python console, and also discover all the properties you need using autocompletion with the Tab key:

enter image description here

So concretely you can for instance:

bpy.context.scene.render.image_settings.color_mode = 'RGBA'
bpy.context.scene.render.image_settings.color_depth = '8'
bpy.context.scene.render.image_settings.compression = 20

You can now easily search in the documentation:

enter image description here

And have access to a complete information for the fields values (click me).

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .