Created
July 23, 2019 12:59
-
-
Save niner/0f24bdb76080a2bfbc7e5c3f6376b4b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl6 | |
sub MAIN($file) { | |
my $warn = run('pngcrush', '-n', '-warn', $file, :err).err.slurp-rest; | |
if $warn.contains("PCS illuminant is not D50"|"known incorrect sRGB profile"|"iCCP: Not recognizing known sRGB profile that has been edited") { | |
say "Fixing $file"; | |
my $output = run('pngcrush', '-warn', '-ow', '-rem', 'allb', '-reduce', $file, "$file.tmp", :err).err.slurp-rest; | |
note $output unless $output eq $warn; | |
} | |
elsif $warn { | |
note "Unknown warning: $warn in $file"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment