# How can I output the Compositor result instead of the Render Result when rendering an animation?

I have a File Output node in the compositor to output my composited images for my animation. I put the same output filename (e.g. "anim_###.png") in the Output Properties area so that I can click Render -> View Animation from the menu to review my animation. But when the animation renders, the Render Result overwrites the file from the compositor output.

As a workaround, I delete the filename in the Output Properties area, render the animation, replace the filename that I just deleted, and then click View Animation. This works, but is tedious and error prone.

As an alternative, I would like to be able to simply view an animation using the output images from the compositor instead of relying on the Output Properties settings. Perhaps I could just write a Python script to pull up the animation playback window? But a native solution would be preferable.

I found a simple solution to this problem using Python:

import bpy

def render(rex_x, res_y):
oldx = bpy.context.scene.render.resolution_x
oldy = bpy.context.scene.render.resolution_y
outpath = bpy.context.scene.render.filepath

try:
bpy.context.scene.render.resolution_x = res_x
bpy.context.scene.render.resolution_y = res_y
bpy.context.scene.render.filepath = ''

bpy.ops.render.render(animation=True, write_still=False)

finally:
bpy.context.scene.render.resolution_x = oldx
bpy.context.scene.render.resolution_y = oldy
bpy.context.scene.render.filepath = outpath


The try/finally is to put back the original values in case of semi-catastrophic failure (which actually happened to me just now since my script is more complicated than the minimum version posted here). In my case I also needed to alter the resolution, which cannot be driven using a Driver. So, two birds and all that...