-
Notifications
You must be signed in to change notification settings - Fork 36.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Qt] optimize PNG files #5489
[Qt] optimize PNG files #5489
Conversation
Can you give the exact command line used? I'd like to reproduce this. |
i used |
Doesn't print the warning as the master itself.
|
The result of that command is not identical here. Running the command on top of your output gives an even different result. |
Analyzed. I also assume it could depend on installed imagemagick and libpng version. Here you can see the process of one file.
|
7a626b5
to
f9754ca
Compare
OK this freaks me out. My output differs from yours. From your diff above I thought the problem was an embedded timestamp, however I get no different result from export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
export FAKETIME='2012-12-12 12:12:12'
git reset --hard
find -name \*.png -print0 | xargs -0 -I FILENAME convert -strip FILENAME FILENAME
find -name \*.png -print0 | xargs -0 sha256sum > /tmp/a.txt As from
As it seems, So probably it's just a version difference. My IM is much older:
Edit: OH, I'm running it only one time, not until fixpoint. Will try. |
Now ran it three times, hash was not longer changing. However, still not all match the files in this pull (though some do). See diff here http://paste.ubuntu.com/9550744/ |
I assume this happens because of different imagemagick/libpng versions. I mean, the core business of these tools is to deal with png/bitmap internas. So there might be some byte differences because of different handling. |
Yes, it's not that important. I primarily wanted to be able to reproduce this when people add files (which the script does). Determinism would be a plus, but adding imagemagick to depends would be overkill. |
Needs Rebase |
b2a8f19
to
31a09b0
Compare
Rebased. |
613413b
to
0572ec7
Compare
Updated the script as well as the images so it will use |
Would a tool like optipng or pngcrush or trimage be more appropriate ? |
@zander: pngcrush is included. See my last comment. |
Your script needs Also let's move it to |
- provide a python script - add optimized png files
0572ec7
to
059c889
Compare
Rewrote script, placed it under |
A second run of the script won't change the PNG sha256 (at least in my environment). |
Check that image contents match pre- and post- crushing. Also remove use of external tool to compute sha256 in favor of hashlib.
Looks good to me now. When I re-run this script I get the same output as well.
|
Using `shell=True` can be a security hazard. See e.g. https://docs.python.org/2/library/subprocess.html#subprocess.check_output
Added another commit laanwj@2c77c15 that replaces uses of shell=True with the Python equivalent (as shell=True is less portable, and can be a security hazard). |
Nice. Thanks for the additions. |
Merged via d1aa3c6 (squashed into two commits, one with your changes one with mine) |
Was merged. Closing. |
According to report on #5488 there can be libpng warnings while starting bitcoin-qt.
This PR will strip out unnecessary data (especially color profiles) from all PNG files.