Changeset 117
- Timestamp:
- 02/06/06 21:40:35 (3 years ago)
- Files:
-
- fastphoto/trunk/fastphoto.1 (modified) (1 diff)
- fastphoto/trunk/src/fastphoto.h (modified) (1 diff)
- fastphoto/trunk/src/main.c (modified) (4 diffs)
- fastphoto/trunk/src/resize.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
fastphoto/trunk/fastphoto.1
r116 r117 38 38 \fB\-g\fR, \fB\-\-gray\fR 39 39 Convert to grayscale 40 40 .PP 41 \fBInformational options\fR 42 .TP 43 \fB\-i\fR, \fB\-\-info\fR 44 Display information about the given image and exit 41 45 .PP 42 46 \fBMiscellaneous options\fR fastphoto/trunk/src/fastphoto.h
r116 r117 18 18 int gray; 19 19 int quality; 20 int info; 20 21 }; 21 22 fastphoto/trunk/src/main.c
r116 r117 21 21 { 22 22 printf ("Usage: fastphoto [options] infile outfile\n"); 23 printf ("Res ize a JPEG image\n\n");24 printf (" Options\n");23 printf ("Rescale a JPEG image\n"); 24 printf ("\nScaling options\n"); 25 25 printf (" -x, --width Set the width of the output image\n"); 26 26 printf (" -y, --height Set the height of the output image\n"); 27 27 printf (" -s, --scale Set a percentage to scale the image by\n"); 28 printf ("\nOutput options\n"); 28 29 printf (" -g, --gray Output grayscale\n"); 29 30 printf (" -q, --quality Set the output quality 0-100\n"); 31 printf ("\nInformational options\n"); 32 printf (" -i, --info Print information about image\n"); 33 printf ("\nMiscellaneous options\n"); 34 printf (" -h, --help Display this help and exit\n"); 35 printf (" -v, --version Output version information and exit\n"); 30 36 printf ("\n"); 31 37 } … … 44 50 params->gray = 0; 45 51 params->quality = 0; /* default */ 52 params->info = 0; 46 53 47 54 while (1) { 48 char * optstring = "hvx:y:s:gq ";55 char * optstring = "hvx:y:s:gq:i"; 49 56 50 57 #ifdef HAVE_GETOPT_LONG … … 57 64 {"gray", no_argument, 0, 'g'}, 58 65 {"quality", required_argument, 0, 'q'}, 66 {"info", no_argument, 0, 'i'}, 59 67 {0,0,0,0} 60 68 }; … … 90 98 case 'q': /* quality */ 91 99 params->quality = atoi (optarg); 100 case 'i': /* info */ 101 params->info = 1; 92 102 default: 93 103 break; fastphoto/trunk/src/resize.c
r116 r117 1 #include <stdio.h> 1 2 #include <Epeg.h> 2 3 … … 8 9 Epeg_Image *im; 9 10 int x, y, w, h, scale; 11 const char * comment; 10 12 11 13 im = epeg_file_open(params->infile); 12 14 13 15 epeg_size_get (im, &w, &h); 16 17 if (params->info) { 18 printf ("%s\t%dx%d\n", params->infile, w, h); 19 comment = epeg_comment_get (im); 20 if (comment) printf ("Comment: %s\n", comment); 21 goto im_close; 22 } 23 24 if (params->outfile == NULL) goto im_close; 14 25 15 26 x = params->x; … … 39 50 epeg_file_output_set(im, params->outfile); 40 51 epeg_encode(im); 52 53 im_close: 41 54 epeg_close(im); 42 55 }
