Merge pull request #27 from hannesa2/OnlyDiffFileOutputOption
Option to only copy diff image without showing WIP
This commit is contained in:
25
diff-image
25
diff-image
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
echo "Usage: $0 [<options>] <file1> <file2>"
|
echo "Usage: $0 [<options>] <file1> <file2>"
|
||||||
@ -16,6 +15,7 @@ usage()
|
|||||||
echo " 5% for JPEGs, zero otherwise."
|
echo " 5% for JPEGs, zero otherwise."
|
||||||
echo " -n <name> The name to give the first file."
|
echo " -n <name> The name to give the first file."
|
||||||
echo " -N <name> The name to give the second file."
|
echo " -N <name> The name to give the second file."
|
||||||
|
echo " -o <path> Output pathname to save diff instead of showing it"
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +26,9 @@ exif_only=false
|
|||||||
fuzz=
|
fuzz=
|
||||||
name1=
|
name1=
|
||||||
name2=
|
name2=
|
||||||
while getopts "hb:c:ef:n:N:" opt
|
outputPath=
|
||||||
|
|
||||||
|
while getopts "hb:c:ef:n:N:o:" opt
|
||||||
do
|
do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
h)
|
h)
|
||||||
@ -51,6 +53,9 @@ do
|
|||||||
N)
|
N)
|
||||||
name2="$OPTARG"
|
name2="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
o)
|
||||||
|
outputPath="$OPTARG"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $(( OPTIND - 1 ))
|
shift $(( OPTIND - 1 ))
|
||||||
@ -237,7 +242,13 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
do_compare
|
do_compare
|
||||||
xdg-open "$destfile"
|
if [ -n "$outputPath" ]
|
||||||
|
then
|
||||||
|
echo "Copy diff image to $outputPath"
|
||||||
|
cp "$destfile" "$outputPath"
|
||||||
|
else
|
||||||
|
xdg-open "$destfile"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
w=$(exiftool -p '$ImageWidth' "$f1" || true)
|
w=$(exiftool -p '$ImageWidth' "$f1" || true)
|
||||||
if [[ $w -ge 10000 ]]
|
if [[ $w -ge 10000 ]]
|
||||||
@ -246,6 +257,12 @@ else
|
|||||||
exec open "$destfile" "$f2"
|
exec open "$destfile" "$f2"
|
||||||
else
|
else
|
||||||
do_compare
|
do_compare
|
||||||
exec open "$destfile"
|
if [ -n "$outputPath" ]
|
||||||
|
then
|
||||||
|
echo "Copy diff image to $outputPath"
|
||||||
|
cp "$destfile" "$outputPath"
|
||||||
|
else
|
||||||
|
exec open "$destfile"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user