blob: 19946df4671b3cb0d8a7c51adb7f32ba86774955 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/bin/sh
if [ "$#" -ne 0 ]; then
echo "usage: $0" >&2
exit 1
fi
TMP=$(mktemp)
cat > $TMP;
FORMAT=$(file -ib $TMP | cut -d ";" -f 1);
case "$FORMAT" in
image/png) png2ff < $TMP; ret=$? ;;
image/jpeg) jpg2ff < $TMP; ret=$? ;;
*) xconvert $TMP png:- 2&>/dev/null | png2ff 2&>/dev/null; ret=$? ;;
esac
rm $TMP;
if [ $ret -ne 0 ]; then
printf "%s: failed to convert %s\n" "$0" "$FORMAT" 1>&2;
fi
exit $ret;
|