首先,我对脚本和编码一般都很陌生。请耐心等待我的理解。
小背景: 我在网上发现了两个shell脚本(UNIX)用于我正在处理的游戏中时光倒流照片项目。脚本应该将每个图像上的垂直条带切片,然后将所有图像拼接到一个图像上。因为我使用Windows,所以我在cygwin中运行脚本。
对我的问题: 这两个脚本都不适合我。他们俩都应该这样做。他们只是完成这项工作的不同方式。但我似乎无法让它发挥作用。我总是收到错误“未找到事件”(版本1)或“Ivalid Paramteter”(版本2)。我已经改变了代码以适应我的图像分辨率并正确地确定切片的宽度和高度。
脚本:
版本2:
tmpdir=tmp
if [ -d "$tmpdir" ]; then
rm -rf $tmpdir
fi
mkdir $tmpdir
height=2592
width=10
n=0
for f in *.jpg
do
offset=$(($n*$width))
c="$(printf "%05d" $n)"
echo "Creating slice $tmpdir/$c.png"
convert -crop ${width}x${height}+${offset}+0 $f $tmpdir/$c.png
n=$(($n+1))
done
count="$(ls -1 $tmpdir | wc -l)"
echo "Joining $count slices into out.png"
montage $tmpdir/*.png -mode concatenate -tile ${count}x out.png
有人可以帮助我吗?
提前致谢!