-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 378b862
Showing
31 changed files
with
1,245 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
OptImgSH v2.6 | ||
|
||
OptImgSH - a set of scripts to optimize images. | ||
|
||
|
||
optimg.sh - optimizing images (jpg | gif | png) without losing quality. | ||
link [bash-optimg] | ||
|
||
jpegmin.sh - optimizing images (jpg) with a loss of quality. | ||
link [bash-jpegmin] | ||
|
||
--- | ||
Made in Russia. | ||
|
||
-- Stargazer -- | ||
I listen to the radio Wild - [http://www.radio-tochka.com:4570/] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Package: bash-optimg | ||
Version: 20141223 | ||
Architecture: all | ||
Maintainer: zvezdochiot <[email protected]> | ||
Section: utils | ||
Priority: optional | ||
Installed-Size: 64 | ||
Depends: imagemagick, libjpeg-progs, gifsicle, pngcrush, optipng, advancecomp, pngnq, bc, coreutils | ||
Homepage: http://mykaralw.narod.ru/ | ||
Description: Bash-script for optimize images. | ||
Bash-script for optimize images: | ||
optimizing images (jpg | gif | png) without losing quality: | ||
bash-optimg image.[png|gif|jpg|jpeg] | ||
bash-optimg-all | ||
optimizing images (jpg | gif | fast png) without losing quality: | ||
bash-optimg-fast image.[png|gif|jpg|jpeg] | ||
bash-optimg-fast-all | ||
optimizing images (jpg | gif | fast png 256 color) without losing quality: | ||
bash-optimg-256 image.[png|gif|jpg|jpeg] | ||
bash-optimg-256-all |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
b30007897e2dae7ef96cef4d6674f295 usr/share/doc/bash-optimg/depends | ||
59e9e74486d8642e6baeafbc0dcaef16 usr/share/doc/bash-optimg/README.EN | ||
fedc59b51e7ac958c9bfbc647a611b84 usr/share/doc/bash-optimg/README.RU | ||
2a1cb2c4c1c62a22029f3e978d5e7004 usr/share/doc/bash-optimg/usage | ||
effc52748f7c227858de3f030c6c04fb usr/share/man/man1/bash-optimg.1.gz | ||
8aa76043b4bf8b61907a90be72f94000 usr/share/scripts/bash/optimg256all.sh | ||
076df68b36da076c72a240f5052059d7 usr/share/scripts/bash/optimg.sh | ||
81fc09bcd16b212c71b6f3fa1c66c09a usr/share/scripts/bash/optimgall.sh | ||
29a77ab3ac31e7b3d7de7bf08af67439 usr/share/scripts/bash/optimgjpeg.sh | ||
3ca4b6bc3069f9ed9b68114d49c22ec3 usr/share/scripts/bash/optimggif.sh | ||
3e9004247e7b67a867b2f6b03c33b77d usr/share/scripts/bash/optimgfastall.sh | ||
1a463542f6bc09b377b30e5b005bbb63 usr/share/scripts/bash/optimgpng.sh | ||
c4f44f56c85d2ba1c6a7ea06882894bd usr/share/scripts/bash/optimgfast.sh | ||
bd781715a7b885160813676818f44f7d usr/share/scripts/bash/optimg256.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../share/scripts/bash/optimg.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../share/scripts/bash/optimg256.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../share/scripts/bash/optimg256all.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../share/scripts/bash/optimgall.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../share/scripts/bash/optimgfast.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../share/scripts/bash/optimgfastall.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../share/scripts/bash/optimggif.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../share/scripts/bash/optimgjpeg.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../share/scripts/bash/optimgpng.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
OptImgSH v2.6 | ||
|
||
OptImgSH - a set of scripts to optimize images. | ||
|
||
|
||
optimg.sh - optimizing images (jpg | gif | png) without losing quality. | ||
link [bash-optimg] | ||
|
||
jpegmin.sh - optimizing images (jpg) with a loss of quality. | ||
link [bash-jpegmin] | ||
|
||
--- | ||
Made in Russia. | ||
|
||
-- Stargazer -- | ||
I listen to the radio Wild - [http://www.radio-tochka.com:4570/] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
OptImgSH v2.6 | ||
|
||
OptImgSH - комплект скриптов для оптимизации изображений. | ||
|
||
|
||
optimg.sh - оптимизация изображений (jpg|gif|png) без потери качества. | ||
link [bash-optimg] | ||
|
||
jpegmin.sh - оптимизация изображений (jpg) с потерей качества. | ||
link [bash-jpegmin] | ||
-- | ||
Сделано в России. | ||
|
||
-- звездочет -- | ||
Я слушаю Дикое радио - [http://www.radio-tochka.com:4570/] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#optimg.sh | ||
#depends: | ||
|
||
imagemagick | ||
libjpeg-progs | ||
gifsicle | ||
pngnq | ||
pngcrush | ||
optipng | ||
advancecomp | ||
coreutils | ||
|
||
#end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Bash-script for optimize images: | ||
optimizing images (jpg | gif | png) without losing quality: | ||
|
||
$ bash-optimg image.[png|gif|jpg|jpeg] | ||
$ bash-optimg-all | ||
|
||
optimizing images (jpg | gif | fast png) without losing quality: | ||
|
||
$ bash-optimg-fast image.[png|gif|jpg|jpeg] | ||
$ bash-optimg-fast-all | ||
|
||
optimizing images (jpg | gif | fast png 256 color) without losing quality: | ||
|
||
$ bash-optimg-256 image.[png|gif|jpg|jpeg] | ||
$ bash-optimg-256-all | ||
|
||
# Made in Russia. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bash-optimg.1.gz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bash-optimg.1.gz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bash-optimg.1.gz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bash-optimg.1.gz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bash-optimg.1.gz |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
#!/bin/bash | ||
|
||
VER="20140329" | ||
GREEN="\033[1;32m" | ||
RED="\033[0;31m" | ||
YELLOW="\033[1;33m" | ||
ENDCOLOR="\033[0m" | ||
|
||
RAMDISK="/dev/shm" | ||
|
||
tproc=`basename $0` | ||
echo -e $GREEN"$tproc version $VER"$ENDCOLOR | ||
echo "" | ||
|
||
usage() | ||
{ | ||
tproc=`basename $0` | ||
echo -e $YELLOW"usage:"$ENDCOLOR | ||
echo -e $GREEN" bash $tproc img-before.[jpg|gif|png] "$ENDCOLOR | ||
exit 0 | ||
} | ||
|
||
testargs() | ||
{ | ||
if [ "+$1" = "+" -o "+$1" = "+--help" -o "+$1" = "+-h" ] | ||
then | ||
usage | ||
fi | ||
} | ||
|
||
testcomponent() | ||
{ | ||
tnocomp="" | ||
tcomp="/usr/bin/identify" | ||
tdeb="imagemagick_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/usr/bin/jpegtran" | ||
tdeb="libjpeg-progs_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/usr/bin/gifsicle" | ||
tdeb="gifsicle_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/usr/bin/pngcrush" | ||
tdeb="pngcrush_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/usr/bin/optipng" | ||
tdeb="optipng_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/usr/bin/advpng" | ||
tdeb="advancecomp_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
tcomp="/usr/bin/stat" | ||
tdeb="coreutils_*.deb" | ||
if [ ! -f "$tcomp" ] | ||
then | ||
tnocomp="$tnocomp $tcomp($tdeb)" | ||
fi | ||
if [ "+$tnocomp" != "+" ] | ||
then | ||
echo -e $RED"Not found $tnocomp !"$ENDCOLOR | ||
echo "" | ||
exit 0 | ||
fi | ||
} | ||
|
||
testsource() | ||
{ | ||
src="$1" | ||
if [ ! -f "$src" ] | ||
then | ||
echo "File $src does not exist" | ||
usage | ||
fi | ||
} | ||
|
||
main() | ||
{ | ||
tproc=`basename $0` | ||
src="$1" | ||
|
||
if [ -d "$RAMDISK" ] | ||
then | ||
tmppath="$RAMDISK" | ||
else | ||
tmppath="/tmp" | ||
fi | ||
TYPE=`identify "$src" | grep -E -o 'JPEG|GIF|PNG'` | ||
OLD=`stat -c %s "$src"` | ||
|
||
echo "$src: $OLD" | ||
case "$TYPE" in | ||
JPEG) | ||
tmpjp="$tmppath/optimg.p.$$.jpg" | ||
tmpjn="$tmppath/optimg.n.$$.jpg" | ||
jpegtran -copy none -optimize -perfect -progressive -outfile "$tmpjp" "$src" | ||
jpegtran -copy none -optimize -perfect -outfile "$tmpjn" "$src" | ||
if [ -f "$tmpjp" -a -f "$tmpjn" ]; then | ||
S_PROG=`stat -c %s "$tmpjp"` | ||
S_NORM=`stat -c %s "$tmpjn"` | ||
echo " normal: $S_NORM" | ||
echo " progressive: $S_PROG" | ||
if [ $S_PROG -ge $S_NORM ]; then | ||
mv -f "$tmpjn" "$src" | ||
rm -f "$tmpjp" | ||
else | ||
mv -f "$tmpjp" "$src" | ||
rm -f "$tmpjn" | ||
fi; | ||
fi | ||
;; | ||
|
||
GIF) | ||
gifsicle -O2 -b "$src" | ||
;; | ||
|
||
PNG) | ||
tmppng="$tmppath/optimg.$$.png" | ||
pngcrush -q -rem alla -fix "$src" "$tmppng" | ||
if [ ! -s "$tmppng" ] | ||
then | ||
cp "$src" "$tmppng" | ||
fi | ||
tsize=`stat -c %s "$tmppng"` | ||
echo " pngcrush: $tsize" | ||
optipng -zc6-9 -zm1-9 -zs0-3 -f0-5 -q -fix "$tmppng" | ||
tsize=`stat -c %s "$tmppng"` | ||
echo " optipng: $tsize" | ||
advpng -z -4 -q "$tmppng" | ||
tsize=`stat -c %s "$tmppng"` | ||
echo " advpng: $tsize" | ||
if [ -f "$tmppng" ]; then | ||
mv -f "$tmppng" "$src" | ||
fi; | ||
;; | ||
esac | ||
|
||
NEW=`stat -c %s "$src"` | ||
SDIFF=$(($NEW * 100 / $OLD)) | ||
|
||
echo "old size: $OLD, new size: $NEW ($SDIFF%)" | ||
echo "" | ||
} | ||
|
||
testargs "$@" | ||
testcomponent | ||
testsource "$@" | ||
main "$@" | ||
|
||
#end |
Oops, something went wrong.