Blender視圖渲染并保存渲染圖
import bpy
# Set the output file path
output_file = "C:/tmp/output.png"
# Set the viewport resolution
bpy.context.scene.render.resolution_x = 1920
bpy.context.scene.render.resolution_y = 1080
# Set the output format
bpy.context.scene.render.image_settings.file_format = "PNG"
# Render the viewport and save the result
bpy.ops.render.opengl()
bpy.data.images["Render Result"].save_render(output_file)
標簽: