Skip to content
Snippets Groups Projects
Commit f66ace4d authored by Jan Schnathmeier's avatar Jan Schnathmeier
Browse files

Add a script to rename IsotropicRemesher output screenshots so that they are...

Add a script to rename IsotropicRemesher output screenshots so that they are numbered sequentially (for ffmpeg)
parent 7610e8e7
No related branches found
No related tags found
No related merge requests found
# A simple script to rename the output screenshots of IsotropicRemesher
# so that their names end in sorted numbers; this allows easy use as
# frames to render a video, eg. with ffmpeg:
# ffmpeg -f image2 -pix_fmt yuv420p -i target1-iterations20/IsoRemesh%d.png t1-i20.mp4
from glob import glob
import os
files_list = glob("*")
for file in files_list:
numbers = [file]
for s in file:
if s.isdigit():
numbers.append(s)
l = len(numbers)
if l == 2:
numbers.append("0")
if l == 3:
numbers.append(str(int(numbers[1])*5+int(numbers[2])+1))
if l == 4:
numbers.append(str((int(numbers[1])*10+int(numbers[2]))*5+int(numbers[3])+1))
os.rename(numbers[0], "IsoRemesh"+numbers[-1]+".png")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment