###################################################################### # 2005-09-22 # # I developed this worksheet to create slideshow. The output is an # avi file compatible with mplayer, realplay, wmp, etc.... # ###### # # bash --version # GNU bash, version 3.00.0(1)-release (i586-suse-linux) # # sed --version # GNU sed version 4.1.2 # # grep --version # grep (GNU grep) 2.5.1 # # convert | head -n 1 # Version: ImageMagick 6.0.7 03/11/05 Q16 http://www.imagemagick.org # # http://www.imagemagick.org/script/links.php # ###### # # there is a colorspace issue that is solved by using # various "#RRGGBB" such that jpeg2yuv no longer complains. # # mozilla -remote "openURL(file:"`pwd`"/Storyboard.html)" # ######################################################################
##### PRELIMINARIES # 0) create a project directory # 1) into it, place a group of potential photos # 2) edit and crop the photos to suit # 3) images ought not have names beginning with ?_, such as t_ # 4) images must not have names containing spaces ##### MAKE TEXT SLIDES ##### OPTIONAL # http://www.cit.gu.edu.au/~anthony/graphics/imagick6/fonts/ # peruse available fonts convert -list type # make slide # use 1022x766 if you will be adding a border later convert \ -size 1022x766 xc:"#010203" \ -font Helvetica \ -pointsize 50 -fill "#FEFE00" -draw "text 300,300 'Images From 2004'" \ -pointsize 20 -fill "#AAAAAA" -draw "text 450,400 'Mike'" \ -pointsize 15 -fill "#AAAAAA" -draw "text 900,750 '2005-09-15'" \ Title_01.jpg identify Title_01.jpg display Title_01.jpg # make slide convert \ -size 1022x766 xc:"#010203" \ -font Helvetica \ -pointsize 15 -fill "#BBBBBB" -draw "text 451,300 'the end'" \ End_01.jpg identify End_01.jpg display End_01.jpg ##### MAKE A STORYBOARD ##### OPTIONAL # convert non-jpgs to jpgs for i in `ls -1 *gif *tif *xcf`; do k=t_`echo $i | sed -e 's#gif$\|tif$\|xcf$#jpg#'` echo "making jpgs: $i $k"; convert -quality 85 $i $k; done # create thumbnails # note that the (optional) ! forces the size rm -fv t_*jpg for i in `ls -1 Title_??.jpg 2004*jpg End_??.jpg`; do k=t_$i echo "thumbnail: $i $k"; convert -quality 75 -geometry 175x131! $i $k; done # create html file printf "%s" '<html><body>' > Storyboard.html for i in `ls -1 t_Title_??.jpg` \ `ls -1 t_*.jpg | grep -v "Title\|End"` \ `ls -1 t_End_??.jpg`; do echo $i; printf "%s" "<img src='$i'>" >> Storyboard.html; done printf "%s" '</html></body>' >> Storyboard.html mozilla -remote "openURL(file:"`pwd`"/Storyboard.html)" # Use an html editor to drag (or cut-n-paste) the thumbnails into # desired order. For example, open the html file in mozilla then # do a Ctrl-E, which will open it in an editor, such as composer. # Since the images will be packed edge-toedge, pasting an image # into a specific spot requires a trick. First cut the the # desired image, then click on the image that preceeds the # insertion point, then press the right-arrow, then paste. Also, # delete from the storyboard any images that are undesired. ##### EXTRACT IMAGE SEQUENCE FROM STORYBOARD ##### OPTIONAL cat Storyboard.html | \ sed -e "s#img src[=\"\']*#\n#g" | \ sed -e 's#\.jpg.*$#.jpg#' > \ xx # or cat Storyboard.html | \ sed -e "s#\(t_[a-zA-Z0-9_.-]*.jpg\)#\n\1\n#g" > \ xx # or cat Storyboard.html | \ sed -e "s#\([^\<\>\=\ \"\']*.jpg\)#\n\1\n#g" > \ xx # grab only the jpg lines, and remove the thumbnail prefix grep jpg xx | sed -e 's#^t_##' > Sequence wc Sequence ##### RESIZE IMAGES TO SIZE OF PRESENTATION # LCD projector is 1024x768, but resize to 1022x766 in anticipation # of adding a one pixel border # # Note that by default, convert will preserve the aspect ratio, # meaning that the option -geometry specifies the maximum width and # height and that actual sizes will end up as 1022x743 or 972x766 # or .... rm -fv p_*; for i in `cat Sequence`; do k=p_${i/jpg/tif}; echo "sizing $i $k"; convert -geometry 1022x766 $i $k; done identify p_* | grep -v DirectClass ##### ADD BORDERS # borders are helpful for images that have black margin rm -fv b_*; for i in `cat Sequence`; do j=p_${i/jpg/tif} k=b_${i/jpg/tif} echo "border $j $k"; convert -border 1x1 -bordercolor "#CCCCCC" $j $k; done identify b_* | grep -v DirectClass ##### ADD BACKDROP TO MAKE THE FINAL SIZE EXACTLY 1024 x 768 # create the backdrop convert -size 1024x768 xc:"#010203" Backdrop.jpg rm -fv m_*; for i in `cat Sequence`; do j=b_${i/jpg/tif}; k=m_$i; echo "matting $j $k"; composite -quality 85 -gravity center $j Backdrop.jpg $k; done identify m_* | grep -v DirectClass ##### CREATE LINKS NAMED ACCORDING TO CONVENTION OF jpeg2yuv # jpeg2yuv naming is zero-based rm -fv z_??.jpg; nn=-1; for i in `cat Sequence`; do (( nn += 1 )); j=m_$i; k=z_`printf "%02d" $nn`.jpg; echo "linking $j $k"; ln -s $j $k; done; # to allow the audio track to continue for a few seconds after # the final slide, create empty trailing slides as desired # # note: do not re-init $nn for i in `seq 1 3`; do (( nn += 1 )); j=Backdrop.jpg; k=z_`printf "%02d" $nn`.jpg; echo "trail $j $k" ; ln -s $j $k; done identify z_* | grep -v DirectClass ##### CREATE SLIDESHOW # https://sourceforge.net/docman/display_doc.php?docid=3456&group_id=5776#ss4.1 jpeg2yuv -f .215 -I p -j z_%02d.jpg | yuv2lav -o V.avi # -f is the frame rate in frames-per-second # # a variable framerate can be obtained by choosing a common # increment, such as one half of a second, then creating as # many links per image as the desired duration. The avi # file size grows accordingly, but is still quite managable ##### ADD IN MUSIC lavaddwav V.avi Keola_beamer__e_kuu_morning_dew.wav AV.avi mplayer AV.avi # lavaddwav will report the durations of the video and audio tracts. # Using that information, adjust the frame-rate option value used in # the preceeding step. -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list
