diff options
author | Hubert Figuiere <hub@figuiere.net> | 2008-02-24 12:06:27 -0500 |
---|---|---|
committer | Hubert Figuiere <hub@figuiere.net> | 2008-02-24 12:06:27 -0500 |
commit | 56cb4be9280ad8c32e3e8f668b42c53f5cc53c71 (patch) | |
tree | 610bfcdd336438486add6886450f8e9a5ab0f84f /demo | |
parent | b33ce211fcc30e04c0b9df6d5e0ed3035c36a245 (diff) |
* demo/thumbc.c (main): Add -s option to allow
passing the request thumbnail size.
Diffstat (limited to 'demo')
-rw-r--r-- | demo/thumbc.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/demo/thumbc.c b/demo/thumbc.c index 984a1c0..054f246 100644 --- a/demo/thumbc.c +++ b/demo/thumbc.c @@ -21,13 +21,33 @@ #include <stdio.h> +#include <unistd.h> +#include <stdlib.h> #include <libopenraw/libopenraw.h> int main(int argc, char **argv) { - char *filename = argv[1]; + char *filename; + int thumb_size = 160; + int opt; + + while ((opt = getopt(argc, argv, "s:")) != -1) { + switch(opt) { + case 's': + thumb_size = atoi(optarg); + break; + default: + break; + } + } + + if(optind >= argc) { + fprintf(stderr, "Missing filename\n"); + return 1; + } + filename = argv[optind]; ORThumbnailRef thumbnail = NULL; (void)argc; @@ -43,7 +63,7 @@ main(int argc, char **argv) or_error err; err = or_get_extract_thumbnail(filename, - 160, &thumbnail); + thumb_size, &thumbnail); if (err == OR_ERROR_NONE) { const char* outfname = "thumb.raw"; |