[trivial] Make optimize-pngs.py also cover share/pixmaps

Also fix:
"Exception: tostring() has been removed. Please call tobytes() instead."
This commit is contained in:
MarcoFalke 2015-09-26 18:01:28 +02:00
parent 8a320c7956
commit 3507992bcf

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python #!/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). Run this script 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 #pngcrush -brute -ow -rem gAMA -rem cHRM -rem iCCP -rem sRGB -rem alla -rem text
''' '''
import os import os
@ -18,12 +18,12 @@ def content_hash(filename):
'''Return hash of RGBA contents of image''' '''Return hash of RGBA contents of image'''
i = Image.open(filename) i = Image.open(filename)
i = i.convert('RGBA') i = i.convert('RGBA')
data = i.tostring() 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"] folders = ["src/qt/res/movies", "src/qt/res/icons", "share/pixmaps"]
basePath = subprocess.check_output([git, 'rev-parse', '--show-toplevel']).rstrip('\n') basePath = subprocess.check_output([git, 'rev-parse', '--show-toplevel']).rstrip('\n')
totalSaveBytes = 0 totalSaveBytes = 0
noHashChange = True noHashChange = True