I'm trying to get my renders to output to a python list or NumPy array. Currently, I'm doing this by rendering the image to disk (with a script), then using a separate python script to read the image off of disk, which seems like a very slow process. Is there a way I can render directly to a python list without having to save it to disk?

import bpy
import sys

import time
import threading
import os

filepath = "C:/yeet/yoink.jpg"

def get_override(area_type, region_type):
    for area in bpy.context.screen.areas: 
        if area.type == area_type:             
            for region in area.regions:                 
                if region.type == region_type:                    
                    override = {'area': area, 'region': region} 
                    return override
    #error message if the area or region wasn't found
    raise RuntimeError("Wasn't able to find", region_type," in area ", area_type,
                        "\n Make sure it's open while executing script.")
def rotate_cam():
    #initial loc/rot of camera
    bpy.context.scene.camera = bpy.context.object
    #add "track to" constraint so camera points at object named 'Cube'
    constraint = bpy.context.object.constraints.new('TRACK_TO')
    constraint.target = bpy.data.objects['Cube']
    constraint.track_axis = 'TRACK_NEGATIVE_Z'
    constraint.up_axis = 'UP_Y'
    #repeatedly rotate camera around 3D cursor (which is at origin) and render
    bpy.context.scene.tool_settings.transform_pivot_point = 'CURSOR'
    override = get_override( 'VIEW_3D', 'WINDOW' )

    for i in range(100):
        bpy.ops.transform.rotate(override, value=.2, orient_axis="Z")
        bpy.context.scene.render.filepath = filepath
        #Here's where I would like it to render to a python list or numpy array
        bpy.ops.render.render(write_still = True)

if __name__ == "__main__":


You must log in to answer this question.

Browse other questions tagged .