1
$\begingroup$

I use script to split render scene to smaller pieces (tiles) - by setting use_border = True. Then "tiles" are rendered, and after process finishing, I join "tiles" to final image. To make it easier, I use RGBA setting during render process. It works fine. But sometimes (for some input files) I get error: bpy_struct: item.attr = val: enum "RGBA" not found in ('BW', 'RGB')

I set value RGBA by command: bpy.context.scene.render.image_settings.color_mode ='RGBA'

I get the error message during rendering demo file "Barcelona Pavillion" from this web page: www.blender.org/download/demo-files/

In Blender GUI I can change to RGBA mode for this file - even if I set border (by Ctrl+B) and render part of scene.

Do you have any idea how to set RGBA for this file by Python script ?

I use Blender version 2.79b

Runnable example:

import bpy

bpy.ops.wm.open_mainfile (filepath="pavillon_barcelone_v1.2.blend", load_ui=False)

rndr = bpy.context.scene.render

rndr.use_border = True
rndr.use_crop_to_border = False

rndr.border_min_x = 0.3333
rndr.border_min_y = 0.3333
rndr.border_max_x = 0.6666
rndr.border_max_y = 0.6666
bpy.context.scene.cycles.device = 'CPU'

rndr.image_settings.color_mode ='RGBA'

result = bpy.ops.render.render (write_still=True)
$\endgroup$
1
$\begingroup$

Little mistake :-) I haven't set output format. There was set JPEG and it has no transparency.

When I put this line (before RGBA assignment):

rndr.image_settings.file_format = 'PNG'

script works.

$\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.