Adobe Fusion 360 Python script to extract 360 video frames
#!/usr/bin/python | |
import argparse | |
import base64 | |
import os | |
# This file parses the HTML created by Adobe Fusion 360 Turntable rendering feature and saves the frames as individual PNGs | |
def parse_html_dump_images(html_file): | |
for i, line in enumerate(html_file): | |
# line 135 is the one that holds the image array | |
if i == 134: | |
# split the line into individual images | |
images = line.split('"')[1::2] | |
for j,image in enumerate(images): | |
decoded_img = base64.decodestring(image) | |
# change img.png to whatever the image name you want, it will be prefixed with a number after the files are written | |
with open(str(j) + 'img.png', 'wb') as file: | |
file.write(decoded_img) | |
elif i > 134: | |
break | |
parser = argparse.ArgumentParser(description=""" | |
Finds line 135 and dumps it as separate file | |
""") | |
parser.add_argument('keep_html_file', metavar='keep_html_file', | |
type=file, | |
help='the input html file path') | |
args = parser.parse_args() | |
# Parse html and dump. | |
parse_html_dump_images(args.keep_html_file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment