7
$\begingroup$

I have a different render in all eight render buffer slots. In the UV/Image Editor there is an option to “Save All Images” but when I select it, nothing happens. How do I configure the save path and save all the images that are in all the slots in one operation? If "Save All Images" is not for the render buffer slots then what is it for and is it possible to do what I want to do? I am trying to discover if there is something quicker than selecting each slot and saving out the individual image.

$\endgroup$

3 Answers 3

9
$\begingroup$

save all images is for modified texture images, images that you have loaded from storage or packed in the .blend file and have been edited ,if no straight option is available you can use a script to automate that process . this script will save all non empty slots to the file path specified in the render tab and with the name displayed in the Image-editor and the number of the slot : "Render_Image_slot_1.png"

import bpy

scene = bpy.context.scene
path = scene.render.filepath
ext = scene.render.file_extension
for img in bpy.data.images :
    i = 0
    if img.type == 'RENDER_RESULT' :
        print(img.name)
        for i in range(8):
            img.render_slots.active_index = i
            try :
                img.save_render(path+img.name+"_slot_%d"%i+ext, scene)
                print("slot %d saved"%i)
            except :
                print("Slot %d is empty"%i)

in case you need this more then once here is the Addon file for download install it and you'll find the entry in UV/Image-editorImageSave_all_slots, you can assign a shortcut for it.

enter image description here

to install : enter image description here

$\endgroup$
10
  • $\begingroup$ The add-on for download is a blend file and not a python script? I opened the blend file but I don't see the "Save render slots" option. How do I implement the script exactly so that I can see what you show in the image? $\endgroup$ Commented May 23, 2015 at 18:35
  • $\begingroup$ @BrysonJack sorry my mistake I'll re-upload the file it is supposed to be a ".py" file, a minute $\endgroup$
    – Chebhou
    Commented May 23, 2015 at 18:37
  • $\begingroup$ @BrysonJack I have updated the link , if you still have problem comment $\endgroup$
    – Chebhou
    Commented May 23, 2015 at 18:44
  • $\begingroup$ I took the script above, made it a .py file, zipped it, installed it and confirmed it went into my add-ons directory but I still don't see the "Save render slots" menu. Weird. $\endgroup$ Commented May 23, 2015 at 18:44
  • $\begingroup$ @BrysonJack don't ZIP it install the directly, what version are using ( this is for 2.74 ) $\endgroup$
    – Chebhou
    Commented May 23, 2015 at 18:48
4
$\begingroup$

2.8x


bl_info = {
    "name": "Render slots",
    "author": "Chebhou",
    "version": (1, 0),
    "blender": (2, 80, 0),
    "location": "UV/Image editor > Image >Save render slots",
    "description": "Saves all render slots",
    "warning": "",
    "wiki_url": "",
    "category": "Image"}

#upgraded to 2.80 by BD3D :)

import bpy
from bpy.types import Operator


class save_slots(Operator):
    """Save render slots"""
    bl_idname = "image.save_all_slots"
    bl_label = "save render slots"

    def execute(self, context):
        scene = context.scene
        path = scene.render.filepath
        ext = scene.render.file_extension
        for img in bpy.data.images :
            i = 0
            if img.type == 'RENDER_RESULT' :
                print(img.name)
                for i in range(8):
                    img.render_slots.active_index = i
                    try :
                        img.save_render(path+img.name+f"_slot_{i}"+ext, scene=scene)
                        print("slot %d saved"%i)
                    except :
                        print("Slot %d is empty"%i)

        return {'FINISHED'}



def add_object_button(self, context):
    self.layout.operator(
        save_slots.bl_idname,
        text="Save render slots",
        icon='FILE_IMAGE')

def register():
    bpy.utils.register_class(save_slots)
    bpy.types.IMAGE_MT_image.append(add_object_button)

def unregister():
    bpy.utils.unregister_class(save_slots)
    bpy.types.IMAGE_MT_image.remove(add_object_button)

if __name__ == "__main__":
    register()

```
$\endgroup$
0
$\begingroup$

Great script.

The limit was up to 8 slots. I rewrote the script to allow for no limit. By default, the blender is saved in the "img" folder of the destination folder.

You can also set "filepash" to any folder you like.

for blender 2.8

import bpy, os

scene = bpy.context.scene
blenderpath = bpy.data.filepath
blnderfilename =  os.path.splitext(os.path.basename(bpy.data.filepath))[0]
dirpath = os.path.dirname(blenderpath)

# The directory you want to build.
filepath = os.path.join(dirpath,"img")
os.makedirs(filepath, exist_ok=True)

ext = scene.render.file_extension
rendername = blnderfilename+"_"

renderimg = [i for i in bpy.data.images if i.type == "RENDER_RESULT"][0]
# set first save slot
renderimg.render_slots.active_index = 0


for renderslot in renderimg.render_slots:
    # The file path and render name (slot number) are combined here.
    path = os.path.join(filepath, rendername+renderslot.name+ext)
    try :
        renderimg.save_render(path, scene=scene)
        print("saved",renderslot.name)
    except :
        print("Slot  is empty",renderslot.name)
    # Move to next slot
    renderimg.render_slots.active_index = renderimg.render_slots.active_index+1

enter image description here

enter image description here

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .