Browse Source

Write first file and last

Yannick Ulrich 3 years ago
parent
commit
830d670910
1 changed files with 8 additions and 3 deletions
  1. 8 3
      postprocess.c

+ 8 - 3
postprocess.c

@@ -387,16 +387,21 @@ postprocess_internal(char *burst_dir, char *target_dir, int keep)
             snprintf(outpath, sizeof(outpath), "%s.jpg", target_dir);
 
         if (first) {
-            first = 0;
             imagedata = read_exif(path);
             exif = create_exif(imagedata);
         }
         decoded = debayer_file(path);
-        fprintf(stderr, "JPEG    %s\n", namelist[burst_size]->d_name);
-        save_jpeg(outpath, decoded, 90, exif);
+        if(keep || first) {
+            fprintf(stderr, "JPEG    %s\n", namelist[burst_size]->d_name);
+            save_jpeg(outpath, decoded, 90, exif);
+        }
         fprintf(stderr, "CONVERG %s\n", namelist[burst_size]->d_name);
         stacker_add_image(stacker, decoded->data, decoded->width, decoded->height);
         free(namelist[burst_size]);
+
+        if (first) {
+            first = 0;
+        }
     }
     free(namelist);