Good point. The given printf (without extra format string) would even interpret percent characters and backslashes in file names.
Other special characters like spaces are expanded if unquoted.
Rule: have $var in quotes --> "$var"
Code:
mkdir out_dir
(( num=1 ))
for i in *.jpg ; do
outfilename="out_dir/$i.jpg"
echo "converting $i to $outfilename"
convert "$i" -resize 600x400 "$outfilename"
(( num++ ))
done
Also using (( )) in lieu of let. If needed at all.