Shell 结合 imagemagick

fileList=`find . -regex '.*\.PNG\|.*\.png\|.*\.TGA\|.*\.tga'`
for file in $fileList
do
	echo "$file"
	
	fileW=`identify -format "%w" $file`
	fileH=`identify -format "%h" $file`
	if [ $fileW == 256 ] || [ $fileH == 256 ]
	then
		convert  -resize 256x256! $file $file
		continue
	fi

	if [ $fileW == 128 ] || [ $fileH == 128 ]
	then
		convert -resize 128x128! $file $file
		continue
	fi

	if [ $fileW == 64 ] || [ $fileH == 64 ]
	then
		convert -resize 64x64! $file $file
		continue
	fi
	
done

你可能感兴趣的:(shell)