Changeset View
Changeset View
Standalone View
Standalone View
contrib/devtools/optimize-pngs.py
Show All 24 Lines | def content_hash(filename): | ||||
i = Image.open(filename) | i = Image.open(filename) | ||||
i = i.convert('RGBA') | i = i.convert('RGBA') | ||||
data = i.tobytes() | data = i.tobytes() | ||||
return hashlib.sha256(data).hexdigest() | return hashlib.sha256(data).hexdigest() | ||||
pngcrush = 'pngcrush' | pngcrush = 'pngcrush' | ||||
git = 'git' | git = 'git' | ||||
folders = ["src/qt/res/movies", "src/qt/res/icons", "share/pixmaps"] | folders = ["src/qt/res/animation", "src/qt/res/icons", "share/pixmaps"] | ||||
basePath = subprocess.check_output( | basePath = subprocess.check_output( | ||||
[git, 'rev-parse', '--show-toplevel'], universal_newlines=True, encoding='utf8').rstrip('\n') | [git, 'rev-parse', '--show-toplevel'], universal_newlines=True, encoding='utf8').rstrip('\n') | ||||
totalSaveBytes = 0 | totalSaveBytes = 0 | ||||
noHashChange = True | noHashChange = True | ||||
outputArray = [] | outputArray = [] | ||||
for folder in folders: | for folder in folders: | ||||
absFolder = os.path.join(basePath, folder) | absFolder = os.path.join(basePath, folder) | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |