How get render result from selected slot with python

I have created a script to save the render result to png, but I would like to save different slots.

exist any way to access to Render Result in each slot?

Something like:

img_slot1 = bpy.data.images[‘Render Result’].slot(x)
img_slot2 = bpy.data.images[‘Render Result’].slot(x + 1)

Thanks,
Antonio

I have been reviewing the api, and I can change the current slot, so the steps would be:

  1. Change slot1: bpy.data.images[‘Render Result’].render_slot = 0
  2. Get the image: img_slot1 = bpy.data.images[‘Render Result’]
  3. Change to slot2: bpy.data.images[‘Render Result’].render_slot = 1
  4. Get the image: img_slot2 = bpy.data.images[‘Render Result’]

The question now is, how can know if the slot is empty? with a try/exception or there is a better way?

How to know if a image is empty?

only the image save operator seems to work here, which is not that much of a problem. But really dunno how to test for empty render slots, the image datablock looks empty for python, couldn’t make out a property that would indicate something. Try/except would work:

bpy.ops.image.save_as({‘edit_image’: D.images[‘Render Result’], ‘area’: C.screen.areas[5], ‘window’: C.window}, copy=True, filepath=“C:\ mp\__3.png”)

gives me RuntimeError if there’s an empty slot activated in uv / image editor.

I have used a try/except block and with a saveimage routine I can discard the empty slots.

Thanks for your help!