r5276 - trunk/misc

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Dec 19 07:10:45 EST 2008


Author: div0
Date: 2008-12-19 07:10:45 -0500 (Fri, 19 Dec 2008)
New Revision: 5276

Modified:
   trunk/misc/jpeg-if-not-alpha.sh
Log:
scaledown option


Modified: trunk/misc/jpeg-if-not-alpha.sh
===================================================================
--- trunk/misc/jpeg-if-not-alpha.sh	2008-12-19 10:58:19 UTC (rev 5275)
+++ trunk/misc/jpeg-if-not-alpha.sh	2008-12-19 12:10:45 UTC (rev 5276)
@@ -7,10 +7,16 @@
 for X in "$@"; do
 	case "$X" in
 		*.jpg)
+			if [ -n "$scaledown" ]; then
+				mogrify "$X" -geometry "$scaledown<" -quality 100
+			fi
 			jpegoptim --strip-all -m$qual "$X"
 			;;
 		*.png|*.tga)
-			if convert "$X" -depth 16 RGBA:- | perl -e 'local $/ = \8; while(<>) { substr($_, 6, 2) eq "\xFF\xFF" or exit 1; ++$pix; } END { exit not $pix; }'; then
+			if [ -n "$scaledown" ]; then
+				mogrify "$X" -geometry "$scaledown<" -quality 100
+			fi
+			if convert "$X" -depth 16 RGBA:- | perl -e 'while(read STDIN, $_, 8) { substr($_, 6, 2) eq "\xFF\xFF" or exit 1; ++$pix; } exit not $pix;'; then
 				echo "$X has no alpha, converting"
 				convert "$X" -quality 100 "${X%.*}.jpg"
 				jpegoptim --strip-all -m$qual "${X%.*}.jpg"




More information about the nexuiz-commits mailing list