You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contrib/devtools/optimize-pngs.py
+8-6Lines changed: 8 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,8 @@
1
1
#!/usr/bin/env python
2
-
2
+
'''
3
+
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).
4
+
#pngcrush -brute -ow -rem gAMA -rem cHRM -rem iCCP -rem sRGB -rem alla -rem text
5
+
'''
3
6
importos
4
7
importsys
5
8
importsubprocess
@@ -18,14 +21,12 @@ def content_hash(filename):
18
21
data=i.tostring()
19
22
returnhashlib.sha256(data).hexdigest()
20
23
21
-
#optimize png, remove various color profiles, remove ancillary chunks (alla) and text chunks (text)
22
-
#pngcrush -brute -ow -rem gAMA -rem cHRM -rem iCCP -rem sRGB -rem alla -rem text
printfileDict['file']+"\n size diff from: "+str(fileDict['osize'])+" to: "+str(fileDict['psize'])+"\n old sha256: "+oldHash+"\n new sha256: "+newHash+"\n"
72
74
73
-
print"completed. Total reduction: "+str(totalSaveBytes)+" bytes"
75
+
print"completed. Checksum stable: "+str(noHashChange)+". Total reduction: "+str(totalSaveBytes)+" bytes"
0 commit comments