techage/textures/shrink.py

17 lines
478 B
Python
Raw Normal View History

2019-03-02 12:24:48 +01:00
import os, fnmatch
2020-12-14 22:03:47 +01:00
print(">>> Convert")
2019-03-02 12:24:48 +01:00
for filename in os.listdir("./"):
if fnmatch.fnmatch(filename, "*.png"):
print(filename)
os.system("pngquant --skip-if-larger --quality=80 --strip --output ./%s.new ./%s" % (filename, filename))
2019-03-02 12:24:48 +01:00
2020-12-14 22:03:47 +01:00
print("\n>>> Copy")
2019-03-02 12:24:48 +01:00
for filename in os.listdir("./"):
if fnmatch.fnmatch(filename, "*.new"):
print(filename)
os.remove("./" + filename[:-4])
os.rename("./" + filename, "./" + filename[:-4])