Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add dirty transparency

  • Loading branch information...
commit 12489810969cfc76334c0215c4c540056a14489d 1 parent dd2f679
@burntime authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 tinypng
View
12 tinypng 100644 → 100755
@@ -2,10 +2,11 @@
##
# Author: Alex Kulikov <alex.kulikov@xing.com>
-# Version: 0.2
+# Version: 0.3
# Description: Automated mass optimization script for web images.
#
# Credits:
+# - imagemagick by ImageMagick Studio LLC (http://www.imagemagick.org/script/index.php)
# - pngcrush by Glenn Randers-Pehrson (http://pmt.sourceforge.net/pngcrush)
# - OptiPNG by Cosmin Truta (http://optipng.sourceforge.net)
# - pngout by Ken Silverman (http://advsys.net/ken/utils.htm)
@@ -48,7 +49,7 @@ function count() {
echo "tinypng: Count files"
for x in $(find $TARGET -type f -name '*.png'); do
TOTALFILES=$(($TOTALFILES+1))
- done
+ done
}
#find all PNGs in folder and crush there
@@ -60,7 +61,7 @@ function crushdir() {
position=0
#Seperator in Logfile
echo "====================" $DATE "====================" >> $LOGFILE
-
+
for x in $(find $TARGET -type f -name '*.png'); do
position=$(($position+1))
percentdone=$(($position*100/$TOTALFILES))
@@ -71,7 +72,7 @@ function crushdir() {
crunshPNG $x
- let end=`ls -l pngout.png | tr -s " " | cut -d " " -f 5`
+ let end=`ls -l pngout.png | tr -s " " | cut -d " " -f 5` || 0
totalend=$(($totalend+$end))
rm $x
mv pngout.png $x
@@ -111,6 +112,7 @@ function crushfile() {
}
function crunshPNG() {
+ convert $1 -background Black -alpha Background $1
pngcrush -rem gAMA -rem cHRM -rem iCCP -rem sRGB -brute -l 9 -max -reduce -m 0 -q $1
optipng -o7 -q pngout.png
pngout pngout.png -q -y -k0 -s0
@@ -138,7 +140,7 @@ function conditions() {
if [ -w "$TARGET" ]
then
conditions
-else
+else
echo -e $COL_RED"No write rights or wrong targed!"$COL_RESET
fi
Please sign in to comment.
Something went wrong with that request. Please try again.