123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- #!/bin/sh
- set -e
- if [ "$#" -ne 3 ]; then
- echo "Usage: $0 [burst-dir] [target-name] [save-dng]"
- exit 2
- fi
- BURST_DIR="$1"
- TARGET_NAME="$2"
- SAVE_DNG="$3"
- MAIN_PICTURE="$BURST_DIR"/1
- if [ -f "$MAIN_PICTURE.jpg" ]; then
-
- cp "$MAIN_PICTURE.jpg" "$TARGET_NAME.jpg"
-
- rm -rf "$BURST_DIR"
- exit 0
- fi
- cp "$BURST_DIR"/1.dng "$TARGET_NAME.dng"
- DCRAW=""
- TIFF_EXT="dng.tiff"
- if command -v "dcraw_emu" > /dev/null
- then
- DCRAW=dcraw_emu
-
- set -- -fbdd 1
- elif [ -x "/usr/lib/libraw/dcraw_emu" ]; then
- DCRAW=/usr/lib/libraw/dcraw_emu
-
- set -- -fbdd 1
- elif command -v "dcraw" > /dev/null
- then
- DCRAW=dcraw
- TIFF_EXT="tiff"
- set --
- fi
- CONVERT=""
- if command -v "convert" > /dev/null
- then
- CONVERT="convert"
-
- set -- -fbdd 1
- elif command -v "gm" > /dev/null
- then
- CONVERT="gm"
- fi
- if [ -n "$DCRAW" ]; then
-
-
-
-
-
- $DCRAW +M -H 4 -o 1 -q 3 -T "$@" "$MAIN_PICTURE.dng"
-
- if [ -n "$CONVERT" ];
- then
- if [ "$CONVERT" = "convert" ]; then
- convert "$MAIN_PICTURE.$TIFF_EXT" -sharpen 0x1.0 -sigmoidal-contrast 6,50% "$TARGET_NAME.jpg"
- else
-
- gm convert "$MAIN_PICTURE.$TIFF_EXT" -sharpen 0x1.0 "$TARGET_NAME.jpg"
- fi
-
-
- if command -v exiftool > /dev/null
- then
- exiftool -tagsFromfile "$MAIN_PICTURE.$TIFF_EXT" \
- -software="Megapixels" \
- -overwrite_original "$TARGET_NAME.jpg"
- fi
- echo "$TARGET_NAME.jpg"
- else
- cp "$MAIN_PICTURE.$TIFF_EXT" "$TARGET_NAME.tiff"
- echo "$TARGET_NAME.tiff"
- fi
- fi
- rm -rf "$BURST_DIR"
- if [ "$SAVE_DNG" -eq "0" ]; then
- rm "$TARGET_NAME.dng"
- fi
|