This is too crunky for words:
#!/bin/bash
# Show an image, then kill the image viewer process after a period of time
if file $1 | grep -q image
then
if anytopnm $1 | xview -quiet stdin &
then
PID=$!
(sleep 5; kill -TERM $PID) &
wait
else
echo $1 is unviewable >&2
fi
else
file $1
fi