5 # Requires ImageMagick and exiftool
10 tmpdir=$(mktemp --tmpdir --directory geeqie_crop_image_XXXXXX)
12 list=$(exiv2 -pp "$1")
15 readarray -t split_list <<<"$list"
17 array_length="${#split_list[@]}"
18 exiv2 -ep"$array_length" "$1" --location "$tmpdir"
20 src_filename=$(ls "$tmpdir/")
21 filename="${src_filename%.*}"
22 extension="${src_filename##*.}"
23 rotation=$(exiftool -Orientation -n "$1" | cut -d':' -f2 | xargs)
24 convert "$tmpdir/$src_filename" -crop "$2" "$tmpdir/$filename-crop.$extension"
26 exiftool -Orientation=$rotation -n "$tmpdir/$filename-crop.$extension"
28 rm "$tmpdir/$src_filename"
30 geeqie --remote view:"$tmpdir/$filename-crop.$extension"
41 tmpdir=$(mktemp --tmpdir --directory geeqie_crop_image_XXXXXX)
43 src_filename=$(basename -- "$1")
44 filename="${src_filename%.*}"
45 extension="${src_filename##*.}"
46 convert "$1" -crop "$2" "$tmpdir/$filename-crop.$extension"
49 zenity --error --title="$title" --text="Cannot process this file format" --width="$width" --window-icon="$window_icon"
51 geeqie --remote view:"$tmpdir/$filename-crop.$extension"
55 export window_icon="/usr/local/share/pixmaps/geeqie.png"
56 export title="Geeqie crop image"
59 if [ -x "$(command -v convert)" ]
61 if [ -x "$(command -v exiftool)" ]
64 coords=$(geeqie --remote --get-rectangle)
68 zenity --error --title="$title" --text="Rectangle coordinates have not been set" --width="$width" --window-icon="$window_icon" 2>/dev/null
72 filename=$(basename -- "$1")
73 extension="${filename##*.}"
75 if [ "${extension,,}" = "jpeg" ]
78 process_plain "$1" $coords
79 elif [ "${extension,,}" = "jpg" ]
82 process_plain "$1" $coords
83 elif [ "${extension,,}" = "png" ]
86 process_plain "$1" $coords
87 elif [ "${extension,,}" = "tif" ]
90 process_plain "$1" $coords
91 elif [ "${extension,,}" = "tiff" ]
94 process_plain "$1" $coords
96 process_raw "$1" $coords
99 process_plain "$1" $coords
103 zenity --info --title="$title" --width="$width" --height=100 --text="Crop image\n\nexiftool is not installed" --title="$title" --window-icon="$window_icon" 2>/dev/null
107 zenity --info --title="$title" --width="$width" --height=100 --text="Crop image\n\nImageMagick is not installed" --title="$title" --window-icon="$window_icon" 2>/dev/null