#!/bin/bash # display exif information for the image path passed... "$1" # test if a filename was passed, try drag and drop if not # c2011-2018 by Paul Sherman, GPL3 if [ "$#" == "0" ]; then v=`yad --title="Drop Image" --text="Drop image file here,\nthen press execute:" --dnd --button="Execute" --center --width 400 --height 400 | sed 's/^.......//'` if [ -z "$v" ]; then exit 0; fi num=`echo "$v" | grep -c '$'` if [ $num -gt 1 ]; then yad --title "ERROR" --button="gtk-ok:0" --center --window-icon="/usr/share/pixmaps/error.png" --text=" One file at a time, please! " --center --width 300 --height 400 exit 0 fi exiftool -a -G1 -s "$v" | yad --text-info --window-icon="/usr/share/pixmaps/image-x-generic.png" --title "Image Information" --center --width 740 --height 500 exit 0 fi # test if exiftool (needed to gather the image info) is present, bail if not hash exiftool 2>/dev/null || { yad --title "Missing Required Tool" --button="gtk-ok:0" --center --window-icon="/usr/share/pixmaps/error.png" --text=" perl Exiftool is missing \n It is required to display image EXIF information. "; exit 1; } # test if the passed filename is an image: isImage=`file -i "$1" | grep "image/"` if [ -z "$isImage" ] then yad --title "Not an Image" --button="gtk-ok:0" --center --window-icon="/usr/share/pixmaps/error.png" --text=" The filename passed: \n \"$1\" \n does not appear to be an image file. " exit 0 fi # since it seems to be an image, use exiftool and yad to display image information exiftool -a -G1 -s "$1" | yad --text-info --window-icon="/usr/share/pixmaps/image-x-generic.png" --title "Image Information" --center --width 740 --height 500 exit 0