the OLD virtual texture script using Imagemagick is this
Code:
#! /bin/bash
if [ $# -lt 3 -o "$1" = "--help" ]; then
echo
echo 'Usage: virtualtex [--help | <texture name> <tile size> <tile format>] [e|E|w|W]'
echo
echo
echo The shell script \'virtualtex\' is a tool for Celestia \> 1.3.0
echo that supports \'virtual textures\'.
echo
echo The script generates the required tiles tx_i_j of \
desired \(square\) size,
echo \<tile size\>, in a specified format, \<tile format\> = \
png, tga, jpg,...,
echo from an input texture, \<texture name\>, in any popular graphics format.
echo
echo The optional 4th argument e\|E\|w\|W is for the case of tiling
echo square /e/astern \| /w/estern halfes of the full texture separately!
echo
echo Besides Linux/Unix, the script also runs in a current Cygwin \
installation
echo under Windows, \( http://www.cygwin.com \). If the z-shell \(\'zsh\'\) \
is unavailable,
echo it also may be executed with the \'bash\' shell, by replacing \
\#\! /usr/bin/zsh by
echo \#\! /bin/bash in the first line.
echo
echo The script assumes that a recent version \(\>= 6.1.8\) of the ImageMagick package
echo \( http://www.ImageMagick.org \) is installed \
\(either under Unix/Linux or Windows\).
echo The utilities \'convert\' and \'identify\' of that package are used.
echo
echo You may increase the pixel cache size \$maxmem from the 80 MB default
echo value to e.g. 80\% of your RAM size within the script with an editor.
echo This will speed up the performance of \'virtualtex\' considerably.
echo
echo On a PIII/512MB RAM the tiling of a 16k x 8k texture into
echo 32 \(2k x 2k\) tiles now only takes 15 minutes with a Linux OS!
echo
echo Author: Dr. Fridger Schrempp, fridger.schrempp@desy.de
echo Version: 1.04, 02/15/05
echo
else
maxmem=80
texturesize=`identify -format "%wx%h" $1`
texturewidth=`identify -format "%w" $1`
textureheight=`identify -format "%h" $1`
tilesize=$2
tileformat="$3"
echo
echo "Texture size = " $texturewidth "x" $textureheight "tilesize = " $tilesize
echo "Number of tiles =" $(( ((texturewidth/tilesize)) * ((textureheight/tilesize)) ))
echo "Image format of tiles:" $tileformat
echo
echo "Tile: "
echo
convert -cache $maxmem -crop ${tilesize}x${tilesize} $1 out%d.$tileformat
j=0
while (( j * tilesize + tilesize <= textureheight )); do
((offy = j * tilesize))
if [ $# -eq 4 ]; then
if [ "$4" = "e" -o "$4" = "E" ]; then
ioff=$(( texturewidth/tilesize ))
elif [ "$4" = "w" -o "$4" = "W" ]; then
ioff=0
else
echo
echo "*** Incorrect 4th parameter! ***"
echo
return
fi
fi
i=0
while (( i * tilesize + tilesize <= texturewidth )); do
((offx = i * tilesize))
echo "tx_"$((i + ioff))"_"${j}": x-offset:" $((offx + ioff * tilesize)) "y-offset:" $offy
mv out$((i+ ((texturewidth/tilesize)) * j)).$tileformat tx_$((i + ioff))_${j}.$tileformat
((i++))
done
((j++))
done
fi
I still use it for cloud maps ( transparency support in IM)
but from your post you are just cutting images into tiles
there are many ways to do that
for images numbered 1,2,3,4,5... and so on to 65536
Nip2 has a built in "chop" tool
http://www.vips.ecs.soton.ac.uk/index.php?title=VIPS