# How do I stop the Compositor Output Node from overwriting my images on each new render?

Using the compositor node setup above, when I hit F12, it makes a new pass and the rendered images are automatically saved. The problem is that the new render erases the previous one that was saved in my folder.

How can I prevent this?

I've already unchecked the "overwrite" option in the output panel in the properties editor, I did not see any similar options in the compositor editor.

I just want Blender to create a "render01" if a render is already there, exactly like in the outliner!

• I is not clear to me what you expect. The file output is designed to do what is doing: when you render it will save the layers/passes that are connected to it to the designated output path. Are you expecting to generate a new file and rename it every single time? Or do you want to disable the node temporarily until you decide to save the result? If so you can do this by muting the node, so that it stops working until you enable it back. The overwrite function works only for the output of the "composite" node. To save to a new renamed file,most likely you are going to need a script. – cegaton Mar 20 '19 at 15:07
• by the way, disabling the "overwrite" box on the output panel doesn't do renaming either. It is meant to skip saving the files that are already rendered in an animation. – cegaton Mar 20 '19 at 15:13
• If you are saving passes individually consider using a more robust file format like EXR multilayer. EXR will keep your values linear and you can avoid misinterpretations in color spaces later. See: blender.stackexchange.com/questions/16152/…' and blender.stackexchange.com/questions/53300/combining-exr-files/… using EXR multilayer would make it quite easy to change the base name once before hitting the render button. – cegaton Mar 21 '19 at 17:04
• One of the links has a scripted way to set the layers. Maybe that same script can be edited so that it can check if the output file exists and change the name for a new output. I don't speak python, but I'm sure someone here can help with that. – cegaton Mar 21 '19 at 17:09

Thinking ahead, you want the Output Path in sync with all the File Output Nodes of the compositor.

I think one easy way to solve this is adding a 'version number' to all output paths (as usual) and keep all file names in sync. Here is a quick'n dirty Add-on to address that. Once you add v and some arbitrary number to the Output Path, a new 'slider' appears in the Output Area, which allows to change the actual version string on the fly.

render_version.py

# ##### BEGIN GPL LICENSE BLOCK #####
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####

bl_info = {
"name": "Render Version",
"description": "Output version number control",
"author": "p2or",
"version": (0, 0, 2),
"blender": (2, 80, 0),
"location": "Properties > Output > Render Version",
"warning": "", # used for warning icon and text in addons panel
"wiki_url": "",
"tracker_url": "",
"category": "Render"
}

import bpy
import os
import re
from sys import platform
import webbrowser

# ------------------------------------------------------------------------
#    Scene Properties
# ------------------------------------------------------------------------

def rv_update(self, context):
context.area.tag_redraw()
scene = context.scene
render = scene.render

# Replace the render path
render.filepath = version_number(
render.filepath,
scene.rv.rdr_ver
)

# Replace file output
if not scene.render.use_compositing or \
not scene.rv.sync_comp or \
not scene.node_tree:
return

nodes = scene.node_tree.nodes
output_nodes = [n for n in nodes if n.type=='OUTPUT_FILE']

for out_node in output_nodes:
if "LAYER" in out_node.format.file_format:
out_node.base_path = version_number(
out_node.base_path,
scene.rv.rdr_ver)
else:
for out_file in out_node.file_slots:
out_file.path = version_number(
out_file.path,
scene.rv.rdr_ver)
return None

class RVSettings(bpy.types.PropertyGroup):

rdr_ver : bpy.props.IntProperty(
name = "Render Version",
description="Render Version",
default = 1,
min = 1,
update = rv_update)

sync_comp : bpy.props.BoolProperty(
name = "Sync Compositor",
description="Sync version string with File Output nodes",
default = True)

# ------------------------------------------------------------------------
#    Operators
# ------------------------------------------------------------------------

class RVOpenOutputDirectory(bpy.types.Operator):
"""Open up Output Directory in File Browser"""
bl_idname = "rv.output_directory"
bl_label = "Open Output Directory in File Browser"
bl_description = "Output Directory"
bl_options = {'INTERNAL'}

def execute(self, context):
fp = os.path.dirname(context.scene.render.frame_path())
try:
if platform.startswith('darwin'):
webbrowser.open("file://{}".format(fp))
else:
webbrowser.open(fp)
except OSError:
self.report({'INFO'}, "No Folder")
return {'FINISHED'}

class RVOutNodesCleanup(bpy.types.Operator):
"""Remove version strings from File Output Nodes"""
bl_idname = "rv.remove_version_strings"
bl_label = "Remove Version Strings from File Output Nodes"
bl_options = {'REGISTER', 'UNDO'}

@classmethod
def poll(cls, context):
space = context.space_data
return space.type == 'NODE_EDITOR'

def remove_version(self, fpath):
match = re.search(r'(v\d+)', fpath)
delimiters = ("-", "_", ".")
if match:
if tail.startswith(delimiters):
tail = tail[1:]
return fpath[:-1] if fpath.endswith(delimiters) else fpath
else:
return fpath

def execute(self, context):
scene = context.scene
nodes = scene.node_tree.nodes
output_nodes = [n for n in nodes if n.type=='OUTPUT_FILE']

if not output_nodes:
self.report({'INFO'}, "Nothing to operate on")
return {'CANCELLED'}

for out_node in output_nodes:
if "LAYER" in out_node.format.file_format:
out_node.base_path = self.remove_version(out_node.base_path)
for layer in out_node.layer_slots:
layer.name = self.remove_version(layer.name)
else:
out_node.base_path = self.remove_version(out_node.base_path)
for out_file in out_node.file_slots:
out_file.path = self.remove_version(out_file.path)

scene.rv.sync_comp=False
return {'FINISHED'}

# ------------------------------------------------------------------------
#    Drawing
# ------------------------------------------------------------------------

def draw_rv(self, context):
"""Append Properties and Operators to the Output Area"""
rv = context.scene.rv
if re.search("v\d+", context.scene.render.filepath) is not None:
layout = self.layout
#col = layout.column()
row = layout.row(align=True)
row.prop(rv, "rdr_ver") #NODE_COMPOSITING
row.prop(rv, "sync_comp", text="", toggle=True, icon="IMAGE_RGB_ALPHA")
row.operator(RVOpenOutputDirectory.bl_idname, icon="DISK_DRIVE", text="")

# ------------------------------------------------------------------------
#    Helper
# ------------------------------------------------------------------------

"""Replace or add a version string by given number"""

match = re.search(r'v(\d+)', file_path)
if match:
g = match.group(1)
n = str(int(number)).zfill(len(g))
return file_path.replace(match.group(0), "v{v}".format(v=n))

else:
ext = (".png",".jpg",".jpeg","jpg",".exr",".dpx",".tga",".tif",".tiff",".cin")

if "#" in file_path:
dash = file_path.find("#")

elif file_path.endswith(ext):

else:
if file_path.endswith(delimiter):
file_path = file_path.rstrip(delimiter)
return "{fp}{v}".format(fp=file_path, v=version)

# ------------------------------------------------------------------------
#    Registration
# ------------------------------------------------------------------------

classes = (
RVSettings,
RVOpenOutputDirectory,
RVOutNodesCleanup,
)

def register():
from bpy.utils import register_class
for cls in classes:
register_class(cls)

bpy.types.Scene.rv = bpy.props.PointerProperty(type=RVSettings)
bpy.types.RENDER_PT_output.append(draw_rv)

def unregister():
from bpy.utils import unregister_class
for cls in reversed(classes):
unregister_class(cls)

bpy.types.RENDER_PT_output.remove(draw_rv)
del bpy.types.Scene.rv

if __name__ == "__main__":
register()

• great solution. It should be implemented in as a feature in blender! – cegaton Mar 27 '19 at 20:47
• I think we can add it to this addon - remaining issue is that it would be nice adding a delimiter at the end of all input names initially to avoid confusing file names like render_v01XXXX.exr when rendering animations. Working on it, thanks for your feedback @cegaton – p2or Mar 27 '19 at 21:06
• this is amazing ! – DB3D Mar 27 '19 at 23:03

In the Properties panel of the File output node select Image/Render, click Add Input and it adds Render_001/Image_001socket. You just plug in to different socket every time you render. As you can see, the subpath name stays the same.