Add shell scripts
This commit is contained in:
parent
0d429b8b2b
commit
8b8f48aea9
36
Scripts/convert2dds
Executable file
36
Scripts/convert2dds
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p /tmp/dds > /dev/null
|
||||
tool="nvcompress"
|
||||
|
||||
for file in "$@"
|
||||
do
|
||||
echo "$file"
|
||||
dirname=$(dirname "$file")
|
||||
basename=$(basename "$file")
|
||||
extname="${file#${file%.*}}"
|
||||
filename=$(basename "$basename" "$extname")
|
||||
|
||||
convert -flip "$file" "/tmp/dds/$basename"
|
||||
alpha=$(convert "$file" -resize 1x1 -format "%[fx:int(255*a+.5)]" info:-)
|
||||
if [ "$tool" == "crunch" ]
|
||||
then
|
||||
if [ $alpha -lt 255 ]
|
||||
then
|
||||
format="-dxt5"
|
||||
else
|
||||
format="-dxt1"
|
||||
fi
|
||||
|
||||
crunch -quiet -file "/tmp/dds/$basename" -fileformat dds $format && rm $file
|
||||
else
|
||||
if [ $alpha -lt 255 ]
|
||||
then
|
||||
format="-bc3"
|
||||
else
|
||||
format="-bc1"
|
||||
fi
|
||||
|
||||
nvcompress $format "/tmp/dds/$basename" "$dirname/$filename.dds" && rm $file
|
||||
fi
|
||||
done
|
14
Scripts/dds2png
Executable file
14
Scripts/dds2png
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p /tmp/dds > /dev/null
|
||||
|
||||
for file in "$@"
|
||||
do
|
||||
echo "$file"
|
||||
dirname=$(dirname "$file")
|
||||
basename=$(basename "$file")
|
||||
extname="${file#${file%.*}}"
|
||||
filename=$(basename "$basename" "$extname")
|
||||
|
||||
convert -flip "$file" "$dirname/$filename.png" && rm $file
|
||||
done
|
Loading…
Reference in New Issue
Block a user