I have the following blender script to get the pixel data of a render
project_path = os.path.dirname(bpy.data.filepath)
render_path = project_path + "/textures/" + collection.name
bpy.context.scene.render.filepath = render_path + ".png"
bpy.ops.render.render(write_still=True)
image = bpy.data.images.load(bpy.context.scene.render.filepath)
pixels = [int(value * 255) for value in image.pixels]
os.remove(bpy.context.scene.render.filepath)
You can see I'm saving the render into a png file which later I load again so I can get the pixel data.
This is not efficient, could be possible to just get the pixel data without saving it into a file?