logitech-g13-badapple/png2pbm.py

16 lines
391 B
Python

#!/usr/bin/env python3
import numpy as np
from PIL import Image
import os
directory = 'images/correctresolution/'
totalFrames = len(os.listdir(directory))
for i in range(totalFrames):
# I mean. Shit. It does it for me.
# But this converts the pngs to pbms (P4)
f = os.path.join(directory, "thumb-" + str(i) + ".png")
im = Image.open(f).convert('1')
im.save("pbm/" + str(i) + ".pbm")