Here is a bash unix test script I wrote to create the lenticular result from 4 equal size images with 2 pixel wide columns.
#!/bin/bash
#NOTE width of images must be divisible by number of images without remainder
#NOTE all images must be same size
infile1="zelda3.png"
infile2="checks.png"
infile3="lena2.png"
infile4="mandril.png"
infileArr=($infile1 $infile2 $infile3 $infile4)
echo "${infileArr[*]}"
num=${#infileArr[*]}
echo "num=$num"
thick=2 # thickness of bands
outfile="test_lenticular2_t${thick}.png"
echo "outfile=$outfile"
# set directory for temporary files
# tmpdir="/tmp"
tmpdir="."
dir="$tmpdir/LENTICULAR.$$"
mkdir "$dir" || errMsg "--- FAILED TO CREATE TEMPORARY FILE DIRECTORY ---"
trap "rm -rf $dir; exit 0" 0
trap "rm -rf $dir; exit 1" 1 2 3 15
# read input images
for ((i=0; i<num; i++)); do
convert -quiet -regard-warnings "${infileArr[$i]}" $dir/tmpI$i.mpc ||
echo "--- FILE ${infileArr[$i]} DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAS ZERO SIZE ---"
done
# get image dimensions
ww=`convert -ping $dir/tmpI1.mpc -format "%w" info:`
hh=`convert -ping $dir/tmpI1.mpc -format "%h" info:`
thick2=`convert xc: -format "%[fx:($num-1)*$thick]" info:`
echo "ww=$ww; hh=$hh; thick2=$thick2;"
# create mask
convert -size ${thick}x1 xc:white -size ${thick2}x1 xc:black +append \
-write mpr:mask +delete -size ${ww}x${hh} tile:mpr:mask \
$dir/tmpM.mpc
#process images
convert -size ${ww}x${hh} xc:none $dir/tmpO.mpc
j=0
for ((i=0; i<num; i++)); do
echo "i=$i; j=$j"
convert $dir/tmpO.mpc $dir/tmpI$i.mpc \( $dir/tmpM.mpc -roll +$j+0 \) \
-compose over -composite $dir/tmpO.mpc
j=$((j+thick))
done
convert $dir/tmpO.mpc $outfile
exit 0
Image1:
Image2:
Image3:
Image4:
Result:
I will try to formalize it and upload to my web site in the next few days.
However, it would be nice to have a real set of images that make a proper lenticular image.