techage_modpack/techage/textures/shrink.py

17 lines
481 B
Python
Raw Normal View History

2020-05-31 23:31:18 +03:00
import os, fnmatch
2021-02-07 16:37:07 +03:00
print(">>> Convert")
2020-05-31 23:31:18 +03:00
for filename in os.listdir("./"):
if fnmatch.fnmatch(filename, "*.png"):
print(filename)
2021-02-07 16:37:07 +03:00
os.system("pngquant --skip-if-larger --quality=60-80 --strip --output ./%s.new ./%s" % (filename, filename))
2020-05-31 23:31:18 +03:00
2021-02-07 16:37:07 +03:00
print("\n>>> Copy")
2020-05-31 23:31:18 +03:00
for filename in os.listdir("./"):
if fnmatch.fnmatch(filename, "*.new"):
print(filename)
os.remove("./" + filename[:-4])
os.rename("./" + filename, "./" + filename[:-4])