Changeset 116
- Timestamp:
- 02/06/06 21:24:22 (3 years ago)
- Files:
-
- fastphoto/trunk/fastphoto.1 (modified) (2 diffs)
- fastphoto/trunk/src/cache.c (modified) (1 diff)
- fastphoto/trunk/src/cgi.c (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) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
fastphoto/trunk/fastphoto.1
r115 r116 20 20 .SH "COMMANDLINE OPTIONS" 21 21 .PP 22 \fB Options\fR22 \fBScale options\fR 23 23 .TP 24 24 \fB\-x\fR, \fB\-\-width\fR … … 30 30 \fB\-s\fR, \fB\-\-scale\fR 31 31 Set the scale as a percentage 32 .PP 33 \fBOutput options\fR 34 .TP 35 \fB\-q\fR, \fB\-\-quality\fR 36 Set the output quality as a percentage 32 37 .TP 33 38 \fB\-g\fR, \fB\-\-gray\fR fastphoto/trunk/src/cache.c
r115 r116 93 93 { 94 94 char * cachedir = FASTPHOTO_DEFAULT_CACHEDIR; 95 char * cachefile ;95 char * cachefile, * c; 96 96 int cached; 97 97 98 98 if (params->scale) { 99 cachefile = alloc_snprintf ("%s%s?scale=%d %s", cachedir, path_info, params->scale, params->gray ? "&gray" : "");99 cachefile = alloc_snprintf ("%s%s?scale=%d", cachedir, path_info, params->scale); 100 100 } else { 101 cachefile = alloc_snprintf ("%s%s?x=%d&y=%d%s", cachedir, path_info, params->x, params->y, params->gray ? "&gray" : ""); 101 cachefile = alloc_snprintf ("%s%s?x=%d&y=%d", cachedir, path_info, params->x, params->y); 102 } 103 104 if (params->quality) { 105 c = alloc_snprintf ("%s&q=%d", cachefile, params->quality); 106 free (cachefile); 107 cachefile = c; 108 } 109 110 if (params->gray) { 111 c = alloc_snprintf ("%s&gray", cachefile); 112 free (cachefile); 113 cachefile = c; 102 114 } 103 115 fastphoto/trunk/src/cgi.c
r115 r116 17 17 if (!strcmp ("scale", key)) params->scale = atoi(val); 18 18 if (!strcmp ("gray", key)) params->gray = 1; 19 if (!strcmp ("quality", key)) params->quality = atoi(val); 20 if (!strcmp ("q", key)) params->quality = atoi(val); 19 21 } 20 22 fastphoto/trunk/src/fastphoto.h
r115 r116 17 17 int scale; 18 18 int gray; 19 int quality; 19 20 }; 20 21 fastphoto/trunk/src/main.c
r115 r116 27 27 printf (" -s, --scale Set a percentage to scale the image by\n"); 28 28 printf (" -g, --gray Output grayscale\n"); 29 printf (" -q, --quality Set the output quality 0-100\n"); 29 30 printf ("\n"); 30 31 } … … 42 43 params->scale = 0; 43 44 params->gray = 0; 45 params->quality = 0; /* default */ 44 46 45 47 while (1) { 46 char * optstring = "hvx:y:s:g ";48 char * optstring = "hvx:y:s:gq"; 47 49 48 50 #ifdef HAVE_GETOPT_LONG … … 54 56 {"scale", required_argument, 0, 's'}, 55 57 {"gray", no_argument, 0, 'g'}, 58 {"quality", required_argument, 0, 'q'}, 56 59 {0,0,0,0} 57 60 }; … … 85 88 case 'g': /* gray */ 86 89 params->gray = 1; 90 case 'q': /* quality */ 91 params->quality = atoi (optarg); 87 92 default: 88 93 break; fastphoto/trunk/src/resize.c
r115 r116 34 34 epeg_decode_colorspace_set (im, EPEG_GRAY8); 35 35 36 if (params->quality) 37 epeg_quality_set (im, params->quality); 38 36 39 epeg_file_output_set(im, params->outfile); 37 40 epeg_encode(im);
