Recent Posts
None | 36 sec ago
C# | 1 min ago
Delphi | 2 min ago
Delphi | 2 min ago
Delphi | 2 min ago
Delphi | 2 min ago
C# | 2 min ago
PHP | 2 min ago
PHP | 2 min ago
Delphi | 2 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
By Anonymous on the 16th of Nov 2008 03:17:41 PM
Download |
Raw |
Embed |
Report
#!/bin/bash
# Breaking/splitting a image into pieces
if [ $# != 5 ] ; then
echo "split.sh <file> <original x pixels> <original y pixels> <slice x pixels> <slice y pixels>"
exit
fi
file=$1
originalx=$2
originaly=$3
slicex=$4
slicey=$5
numberx=$((originalx/slicex))
numbery=$((originaly/slicey))
for i in `seq 0 $numberx`; do
for j in `seq 0 $numbery`; do
convert -crop ${slicex}x${slicey}+$((i*slicex))+$((j*slicey)) $file $file-$j-$i.png
done
done
Submit a correction or amendment below.
[ previous version ] | [ difference ] | Make A New Post