Saving render result to disk in blender 2.54

Hello

I’m playing around with the blender 2.54 python api and I can’t figure out how to save the render result to disk. Getting the bpy.types.Image object corresponding to the render result seems to work but calling the object’s save() method fails with an error message about the image not having any data.

any help would be greatly appreciated

/t

I think I’ve had the same error… may well be a proper bug!!!

these are the steps to reproducing my problem:

  1. render something. this creates an image called “Render Result”.

  2. type the following into the console (or run it as a script).

img = bpy.data.images[‘Render Result’]
img.filepath = “some/path/img.png”
img.save()

  1. observe the error message
    SystemError: Error: Image “Render Result” does not have any image data

If anyone could either tell me what I’m doing wrong or confirm that this is a bug, that would be great.

thanks
/t

I’m struggling with something similar. If I call bpy.ops.render.render(), it seems like it is render (I.e. cpu process is up, etc.) but then the result doesn’t display in a new window as selected. If I try bpy.ops.render.view_show() I get an “invalid operator call.” Any help?

Got it to work this way:

bpy.ops.render.render()
bpy.data.images['Render Result'].save_render(filepath= "some/path/img.png")

Have a nice day

works for me too. thanks!