#!/bin/bash # # slideshow_next image # # This program assumes an image is currently being displayed by the IM # "animate" command. The image currently displayed is stored in the # file "last_image" in the current directory. # # This program will do a animated transition to the new given image. # # If no "animate" is running, one will be started. If no "last_image" file # is found the last image is assumed to be black. # # Note that all images given should be all the same size! # #### # last_image_file=last_image # make this $HOME/.last_image ??? next_image=`realpath "$1"` # I use a temporary file so that I can background the "animate" command temp=/tmp/slideshow.$$.miff trap "rm -f $temp; exit 10" 1 2 3 15 trap "rm -f $temp; exit 0" 0 if [ -s "$last_image_file" ]; then convert "`cat last_image | tr -d '\012'`" miff:- else convert "$next_image" -gamma 0 miff:- fi | # Do you complex image transition here # The final delay is minimum display time convert - "$next_image" -morph 10 \ \( +clone -set delay 500 \) +swap +delete \ $temp # feed transition to the animation animate -remote ephemeral:$temp & # wait for 'ephemeral:' file to have been read while [ -f $temp ]; do sleep .1; done # wait for transition time period to complete sleep 3 # replace the transition image with a loop of the new image animate -delay 100 -remote "$next_image" & echo -n $next_image > last_image