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)
|
2021-02-15 23:51:15 +03:00
|
|
|
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])
|
|
|
|
|