Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(882)

Side by Side Diff: tools/resources/optimize-png-files.sh

Issue 869433004: Pngcrush version determined correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash -i 1 #!/bin/bash -i
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # The optimization code is based on pngslim (http://goo.gl/a0XHg) 6 # The optimization code is based on pngslim (http://goo.gl/a0XHg)
7 # and executes a similar pipleline to optimize the png file size. 7 # and executes a similar pipleline to optimize the png file size.
8 # The steps that require pngoptimizercl/pngrewrite/deflopt are omitted, 8 # The steps that require pngoptimizercl/pngrewrite/deflopt are omitted,
9 # but this runs all other processes, including: 9 # but this runs all other processes, including:
10 # 1) various color-dependent optimizations using optipng. 10 # 1) various color-dependent optimizations using optipng.
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 which $program > /dev/null 2>&1 377 which $program > /dev/null 2>&1
378 if [ $? != 0 ]; then 378 if [ $? != 0 ]; then
379 echo "Couldn't find $program. Please download and install it from $url ." 379 echo "Couldn't find $program. Please download and install it from $url ."
380 exit 1 380 exit 1
381 fi 381 fi
382 } 382 }
383 383
384 # Check pngcrush version and exit if the version is in bad range. 384 # Check pngcrush version and exit if the version is in bad range.
385 # See crbug.com/404893. 385 # See crbug.com/404893.
386 function exit_if_bad_pngcrush_version { 386 function exit_if_bad_pngcrush_version {
387 local version=$(pngcrush -v | awk "/pngcrush 1.7./ {print \$3}") 387 local version=$(pngcrush -v 2>&1 | awk "/pngcrush 1.7./ {print \$3}")
388 local version_num=$(echo $version | sed "s/\.//g") 388 local version_num=$(echo $version | sed "s/\.//g")
389 if [[ (1748 -lt $version_num && $version_num -lt 1773) ]] ; then 389 if [[ (1748 -lt $version_num && $version_num -lt 1773) ]] ; then
390 echo "Your pngcrush ($version) has a bug that exists from " \ 390 echo "Your pngcrush ($version) has a bug that exists from " \
391 "1.7.49 to 1.7.72 (see crbug.com/404893 for details)." 391 "1.7.49 to 1.7.72 (see crbug.com/404893 for details)."
392 echo "Please upgrade pngcrush and try again" 392 echo "Please upgrade pngcrush and try again"
393 exit 1; 393 exit 1;
394 fi 394 fi
395 } 395 }
396 396
397 function show_help { 397 function show_help {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 if [ $PROCESSED_FILE != 0 ]; then 539 if [ $PROCESSED_FILE != 0 ]; then
540 let diff=$TOTAL_OLD_BYTES-$TOTAL_NEW_BYTES 540 let diff=$TOTAL_OLD_BYTES-$TOTAL_NEW_BYTES
541 let percent=$diff*100/$TOTAL_OLD_BYTES 541 let percent=$diff*100/$TOTAL_OLD_BYTES
542 echo "Result: $TOTAL_OLD_BYTES => $TOTAL_NEW_BYTES bytes" \ 542 echo "Result: $TOTAL_OLD_BYTES => $TOTAL_NEW_BYTES bytes" \
543 "($diff bytes: $percent%)" 543 "($diff bytes: $percent%)"
544 fi 544 fi
545 if [ $CORRUPTED_FILE != 0 ]; then 545 if [ $CORRUPTED_FILE != 0 ]; then
546 echo "Warning: corrupted files found: $CORRUPTED_FILE" 546 echo "Warning: corrupted files found: $CORRUPTED_FILE"
547 echo "Please contact the author of the CL that landed corrupted png files" 547 echo "Please contact the author of the CL that landed corrupted png files"
548 fi 548 fi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698