-
-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathfix_png.sh
26 lines (17 loc) · 1 KB
/
fix_png.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
# The script helps to automate fixing issue "libpng warning: iCCP: known incorrect sRGB profile".
# Main idea: https://stackoverflow.com/questions/22745076/libpng-warning-iccp-known-incorrect-srgb-profile
# Use "pngcrush" to remove the incorrect sRGB profile from the png file
# Link: http://pmt.sourceforge.net/pngcrush/
# -ow will overwrite the input file
# -rem allb will remove all ancillary chunks except tRNS and gAMA
# -reduce does lossless color-type or bit-depth reduction
# -brute — attempt all optimization methods
#In the console output you should see "Removed the sRGB chunk.", and possibly more messages about chunk removals.
#You will end up with a smaller, optimized png file. As the command will overwrite the original file, make
#sure to create a backup or use version control.
# IMPORTANT!!! Run script inside 'scripts' directory.
# usage:
# $ ./fix_png.sh
# IMPORTANT!!! Use version 1.8.1 or higher.
find .. -type f -iname '*.png' -exec pngcrush -ow -rem allb -brute -reduce {} \;