techage/textures/shrink.py

17 lines
478 B
Python
Raw Normal View History

2019-03-02 14:24:48 +03:00
import os, fnmatch
2020-12-15 00:03:47 +03:00
print(">>> Convert")
2019-03-02 14:24:48 +03: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 14:24:48 +03:00
2020-12-15 00:03:47 +03:00
print("\n>>> Copy")
2019-03-02 14:24:48 +03:00
for filename in os.listdir("./"):
if fnmatch.fnmatch(filename, "*.new"):
print(filename)
os.remove("./" + filename[:-4])
os.rename("./" + filename, "./" + filename[:-4])