
This allows rejecting output filenames that are outside the repository, and also handles converting eg "-foo" to "./-foo" to prevent a command that it's passed to interpreting the output filename as a dashed option.
22 lines
540 B
Bash
Executable file
22 lines
540 B
Bash
Executable file
#!/bin/sh
|
|
# git-annex compute remote program that uses imagemagic's convert
|
|
# to convert one type of image format into another. Eg, jpeg to gif.
|
|
#
|
|
# Copyright 2025 Joey Hess; licenced under the GNU GPL version 3 or higher.
|
|
set -e
|
|
|
|
if [ -z "$1" ] || [ -z "$2" ]; then
|
|
echo "Specify the input image file, followed by the output image file." >&2
|
|
echo "Example: foo.jpg foo.gif" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "INPUT $1"
|
|
read input
|
|
echo "OUTPUT $2"
|
|
read output
|
|
|
|
if [ -n "$input" ]; then
|
|
mkdir -p "$(dirname "$output")"
|
|
convert "$input" "$output"
|
|
fi
|