4
$\begingroup$

I am trying to set my render to be alpha. i have the following code

scene = bpy.context.scene
scene.render.alpha_mode = 'TRANSPARENT' 
bpy.context.scene.color_mode = 'RGBA'

where of the two first lines works fine, but im getting an error in the last one. so how do i set the color_mode to RGBA, instead of RGB, using python script?

$\endgroup$
6
$\begingroup$

To set the color mode to RGBA for the current scene, use:

 bpy.context.scene.render.image_settings.color_mode ='RGBA'

color_mode is a member ImageFormatSettings, which is in turn a member of RenderSettings. The render settings of a scene are accessible via Scene.render.

See here for an explanation how to find out the access path:
Blender/Python API Reference Usage: examples of how to use the API reference docs

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.