|
@@ -2,9 +2,22 @@
|
|
|
#include <unistd.h>
|
|
|
#include <libnet.h>
|
|
|
|
|
|
-#include "util.h"
|
|
|
#include "postprocess.h"
|
|
|
|
|
|
+void
|
|
|
+print_usage(char *name)
|
|
|
+{
|
|
|
+ fprintf(stderr, "usage: %s [-v] [-q quality] INPUT OUTPUT\n", name);
|
|
|
+ fprintf(stderr, "Post-process a single .dng bayer raw file to a jpeg file.\n\n");
|
|
|
+ fprintf(stderr, "Mandatory arguments\n");
|
|
|
+ fprintf(stderr, "INPUT Input filename, should be a .dng file\n");
|
|
|
+ fprintf(stderr, "OUTPUT Output filename, should be a .jpg file\n\n");
|
|
|
+
|
|
|
+ fprintf(stderr, "Optional arguments\n");
|
|
|
+ fprintf(stderr, " -v Show verbose debugging output\n");
|
|
|
+ fprintf(stderr, " -q 90 Set the output jpeg quality [0-100]\n\n");
|
|
|
+}
|
|
|
+
|
|
|
int
|
|
|
main(int argc, char *argv[])
|
|
|
{
|
|
@@ -14,7 +27,7 @@ main(int argc, char *argv[])
|
|
|
char *input_path;
|
|
|
char *output_path;
|
|
|
|
|
|
- while ((opt = getopt(argc, argv, "vq:")) != -1) {
|
|
|
+ while ((opt = getopt(argc, argv, "vq:h")) != -1) {
|
|
|
switch (opt) {
|
|
|
case 'v':
|
|
|
verbose = 1;
|
|
@@ -22,20 +35,21 @@ main(int argc, char *argv[])
|
|
|
case 'q':
|
|
|
quality = atoi(optarg);
|
|
|
break;
|
|
|
- case 'i':
|
|
|
- printf("input: %s\n", argv[optind]);
|
|
|
- input_path = argv[optind];
|
|
|
- break;
|
|
|
- case 'o':
|
|
|
- printf("output: %s\n", argv[optind]);
|
|
|
- output_path = argv[optind];
|
|
|
- break;
|
|
|
+ case 'h':
|
|
|
+ print_usage(argv[0]);
|
|
|
+ exit(0);
|
|
|
case '?':
|
|
|
- printf("WTF\n");
|
|
|
- break;
|
|
|
+ print_usage(argv[0]);
|
|
|
+ exit(1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (argc < optind + 2) {
|
|
|
+ fprintf(stderr, "Missing image parameters\n");
|
|
|
+ print_usage(argv[0]);
|
|
|
+ exit(1);
|
|
|
+ }
|
|
|
+
|
|
|
input_path = argv[optind];
|
|
|
output_path = argv[optind + 1];
|
|
|
|