#!/bin/sh

##
# $1 : outfile
# $2 : infile
# $3 : image Type (gif : 1, jpg, jpeg : 2)
# cjpeg 명령어의 smooth 옵션의 값은 낮을수록 용량이 커지나, 선명하게 보인다.
##

curDate=`/bin/date +%Y%m%d%H%M%S`;
curDir=\"./imgTemp\";

if [ \"$3\" == \"1\" ]; then
/usr/bin/giftopnm $2 > \"$curDir/news_$curDate.pnm\";
/usr/bin/pnmscale -xy 100 100 "$curDir/news_$curDate.pnm" | /usr/bin/cjpeg -progressive -optimize -smooth 1 -outfile $1;
else
/usr/bin/djpeg -pnm $2 > "$curDir/news_$curDate.pnm";
/usr/bin/pnmscale -xy 100 100 "$curDir/news_$curDate.pnm" | /usr/bin/cjpeg -progressive -optimize -smooth 1 -outfile $1;
fi

rm -rf $curDir/news_$curDate.pnm;

exit 0 

'IT > shell 위 댄스' 카테고리의 다른 글

awk  (0) 2008.02.27
date 매뉴얼  (0) 2008.02.27
쉘로 작성한 ftp 활용  (0) 2008.02.27
sed  (0) 2008.02.27
string 추출  (0) 2008.02.27
블로그 이미지

쩐의시대

나답게 살아가고 나답게 살아가자

,