我正在使用 Hugin 工具集的命令行版本生成全景图。在执行脚本时,所有图像都被分类到包含单个全景图的 n 个图像的文件夹中。根据混合过程的执行,可能会产生两个文件名之一:pano.tif
和pano_blended_fused.tif
.
无论生成哪个文件,我都想将该文件转换为 jpg 并调整大小。我目前的代码是
dirlist=$(find . -mindepth 1 -maxdepth 1 -type d \( ! -name completed \) | sort -n)
for dir in $dirlist
do
#pano generating gode goes here
#Downsize and convert panorama
#######################################################################
tifImage=
jpgImage=
if [ -e "pano.tif" ]; then
tifImage="pano.tif"
jpgImage="pano.jpg"
echo "Working on pano.tif"
echo ""
elif [ -e "pano_blended_fused" ]; then
tifImage="pano_blended_fused.tif"
jpgImage="pano_blended_fused.jpg"
echo "Working on pano_blended_fused.tif"
echo ""
fi
#convert pano to jpg and get count of images in photo folder
echo ""
echo "Converting $image to jpg and creating two versions"
echo ""
mogrify -format jpg $tifImage >> "$imagePath/$dir/log.txt"
num=$(ls -l "$webPath/photos" | wc -l)
prefix=$((num+1))
#convert full size pano to 1000 pixels high and rename with prefix number
#move to /photos folder
convert $jpgImage -geometry x1000 "$prefix-pano.jpg" >> "$imagePath/$dir/log.txt"
mv "$prefix-pano.jpg" "$webPath/photos" >> "$imagePath/$dir/log.txt"
#convert full size pano to 600 pixels wide and rename with prefix number
#move to /thumbs folder
convert $jpgImage -geometry 600x "$prefix-pano.jpg" >> "$imagePath/$dir/log.txt"
mv "$prefix-pano.jpg" "$webPath/thumbs" >> "$imagePath/$dir/log.txt"
done
我昨晚刚做了一批照片,在要生成的 15 张全景图中,只有 9 张进入了目标文件夹。所有其他人在第一个convert
命令中抛出一个错误,指出它缺少图像文件名n-pano.tif
,而该$tifImage
变量应该是pano_blended_fused.tif
我需要做什么才能使pano_blended_fused
图像通过转换过程?