0
$\begingroup$

when render animation with frame end 20 and step 4, will get 5 output file name like this:

0001.png,0005.png,0009.png,0013.png,0017.png

it possible to get output name like this ?.

0001.png,0002.png,0003.png,0004.png,0005.png
$\endgroup$
1
  • 1
    $\begingroup$ Thinking ahead, this doesn't make much sense since you would loose the original filenames, which is a pain to re-construct or figure out what frames you have rendered, later in the process. I'd suggest copy the folder and use something like mucommander to rename the copies to be on the save side. $\endgroup$
    – p2or
    Commented Mar 11, 2021 at 15:07

1 Answer 1

2
$\begingroup$

After render.

If you have set the render file path such that it only contains the rendered images with that file extension, can run this script, from within the blender text editor, after rendering.

import bpy
from pathlib import Path

op = 'RENAME' # to rename
#op = 'CLEAN' # to remove

context = bpy.context
scene = context.scene
render = scene.render
ext = render.file_extension


rfp = Path(render.filepath)
fldr = rfp if rfp.is_dir() else rfp.parent

for f in sorted(fldr.glob(f"*{ext}")):
    if op == 'CLEAN':
        f.unlink()
    elif op == 'RENAME':
        print(f.name, end=" -> ")
        num = int(f.stem) // scene.frame_step + 1
        f2 = fldr / f"{num : 05d}{ext}"
        if not f2.exists():
            f.rename(f2)
        print(f2.name)

Output after rename.

0001.png ->  0001.png
0005.png ->  0002.png
0009.png ->  0003.png
0013.png ->  0004.png
0017.png ->  0005.png
$\endgroup$

You must log in to answer this question.

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