aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-08-07 12:56:38 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-08-07 12:57:17 +0200
commit100c9d3994efa0527915bf15d6cc3078d6b80856 (patch)
treef3dc5ba8131a647569bd934d44aa8ac62cf8dbc0 /contrib
parente545371b77d419b3bf4dd194b3f3c107d9bce6d1 (diff)
parentdf9c2ee1c9c02b79ccbb6cbae03096c3f9af23c7 (diff)
Merge pull request #6505
df9c2ee [Qt] replace wifi icon with network symbol (Marco) 9142867 [QT] cleanup icons (Marco)
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/devtools/optimize-pngs.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/contrib/devtools/optimize-pngs.py b/contrib/devtools/optimize-pngs.py
index 38aaa00f31..b6d6a097d6 100755
--- a/contrib/devtools/optimize-pngs.py
+++ b/contrib/devtools/optimize-pngs.py
@@ -1,5 +1,8 @@
#!/usr/bin/env python
-
+'''
+Run this scrip every time you change one of the png files. Using pngcrush, it will optimize the png files, remove various color profiles, remove ancillary chunks (alla) and text chunks (text).
+#pngcrush -brute -ow -rem gAMA -rem cHRM -rem iCCP -rem sRGB -rem alla -rem text
+'''
import os
import sys
import subprocess
@@ -18,14 +21,12 @@ def content_hash(filename):
data = i.tostring()
return hashlib.sha256(data).hexdigest()
-#optimize png, remove various color profiles, remove ancillary chunks (alla) and text chunks (text)
-#pngcrush -brute -ow -rem gAMA -rem cHRM -rem iCCP -rem sRGB -rem alla -rem text
-
pngcrush = 'pngcrush'
git = 'git'
-folders = ["src/qt/res/movies", "src/qt/res/icons", "src/qt/res/images"]
+folders = ["src/qt/res/movies", "src/qt/res/icons"]
basePath = subprocess.check_output([git, 'rev-parse', '--show-toplevel']).rstrip('\n')
totalSaveBytes = 0
+noHashChange = True
outputArray = []
for folder in folders:
@@ -68,6 +69,7 @@ for fileDict in outputArray:
oldHash = fileDict['sha256Old']
newHash = fileDict['sha256New']
totalSaveBytes += fileDict['osize'] - fileDict['psize']
+ noHashChange = noHashChange and (oldHash == newHash)
print fileDict['file']+"\n size diff from: "+str(fileDict['osize'])+" to: "+str(fileDict['psize'])+"\n old sha256: "+oldHash+"\n new sha256: "+newHash+"\n"
-print "completed. Total reduction: "+str(totalSaveBytes)+" bytes"
+print "completed. Checksum stable: "+str(noHashChange)+". Total reduction: "+str(totalSaveBytes)+" bytes"