Thumbnail table with date/time


/ Published in: Bash
Save to your folder(s)

This script creates thumbnail images containing 25 thumbs each and display the EXIF time and date if your version of ImageMagick supports that (some do not).


Copy this code and paste it in your HTML
  1. #!/bin/sh
  2.  
  3. key=DateTimeOriginal
  4. if [ "$1" = "-k" ]; then
  5. shift
  6. key="$1"
  7. shift
  8. fi
  9.  
  10. moncmd="montage -label %f\\n%[EXIF:$key] -geometry 120x120+20+20"
  11.  
  12. if [ $# -eq 0 ]; then
  13. echo "usage: thumbindex [-k <EXIF key>] <image file> ..."
  14. echo "thumbindex generates images containing 25 thumbnails each of the image files given on the command line." | fmt
  15. exit 0;
  16. fi
  17.  
  18. pagenr=1
  19.  
  20. while [ $# -ge 25 ]; do
  21.  
  22. for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24; do
  23. thispage[$i]=$1
  24. shift
  25. done
  26.  
  27. if [ $pagenr -lt 10 ]; then
  28. $moncmd "${thispage[@]}" thumbindex0$pagenr.jpg
  29. else
  30. $moncmd "${thispage[@]}" thumbindex$pagenr.jpg
  31. fi
  32. pagenr=$((pagenr+1))
  33.  
  34. done
  35.  
  36. if [ $# -eq 0 ]; then
  37. exit 0
  38. fi
  39.  
  40. if [ $pagenr -lt 10 ]; then
  41. $moncmd "$@" thumbindex0$pagenr.jpg
  42. else
  43. $moncmd "$@" thumbindex$pagenr.jpg
  44. fi

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.