瀏覽代碼

postprocess: use the proper file extension when using dcraw

Instead of simply appending ".tiff" to the existing filename (like
`dcraw_emu` does), `dcraw` fully replaces the file extension, leading
`convert` to subsequently fail as it can't find the `.dng.tiff` file.
Arnaud Ferraris 4 年之前
父節點
當前提交
1872efd3d9
共有 1 個文件被更改,包括 7 次插入5 次删除
  1. 7 5
      postprocess.sh

+ 7 - 5
postprocess.sh

@@ -19,7 +19,7 @@ fi
 BURST_DIR="$1"
 TARGET_NAME="$2"
 
-MAIN_PICTURE="$BURST_DIR"/1.dng
+MAIN_PICTURE="$BURST_DIR"/1
 
 # Copy the first frame of the burst as the raw photo
 cp "$BURST_DIR"/1.dng "$TARGET_NAME.dng"
@@ -34,6 +34,7 @@ fi
 
 # Create a .jpg if raw processing tools are installed
 DCRAW=""
+TIFF_EXT="dng.tiff"
 if command -v "dcraw_emu" > /dev/null
 then
 	DCRAW=dcraw_emu
@@ -43,6 +44,7 @@ fi
 if command -v "dcraw" > /dev/null
 then
 	DCRAW=dcraw
+	TIFF_EXT="tiff"
 	set --
 fi
 
@@ -52,24 +54,24 @@ if [ -n "$DCRAW" ]; then
 	# -o 1		Output in sRGB colorspace
 	# -q 3		Debayer with AHD algorithm
 	# -T		Output TIFF
-	$DCRAW +M -H 4 -o 1 -q 3 -T "$@" "$MAIN_PICTURE"
+	$DCRAW +M -H 4 -o 1 -q 3 -T "$@" "$MAIN_PICTURE.dng"
 
 	# If imagemagick is available, convert the tiff to jpeg and apply slight sharpening
 	if command -v convert > /dev/null
 	then
-		convert "$MAIN_PICTURE".tiff -sharpen 0x1.0 "$TARGET_NAME.jpg"
+		convert "$MAIN_PICTURE.$TIFF_EXT" -sharpen 0x1.0 "$TARGET_NAME.jpg"
 
 		# If exiftool is installed copy the exif data over from the tiff to the jpeg
 		# since imagemagick is stupid
 		if command -v exiftool > /dev/null
 		then
-			exiftool -tagsFromfile "$MAIN_PICTURE".tiff \
+			exiftool -tagsFromfile "$MAIN_PICTURE.$TIFF_EXT" \
 				 -software="Megapixels" \
 				 -overwrite_original "$TARGET_NAME.jpg"
 		fi
 
 	else
-		cp "$MAIN_PICTURE".tiff "$TARGET_NAME.tiff"
+		cp "$MAIN_PICTURE.$TIFF_EXT" "$TARGET_NAME.tiff"
 	fi
 fi