Changeset 1909 for libcaca/trunk/src/img2txt.c
- Timestamp:
- Nov 6, 2007, 3:09:07 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/src/img2txt.c
r1908 r1909 44 44 fprintf(stderr, "Example : %s -w 80 -f ansi ./caca.png\n\n", argv[0]); 45 45 fprintf(stderr, "Options:\n"); 46 fprintf(stderr, " -h, --help\tThis help\n"); 47 fprintf(stderr, " -W, --width=WIDTH\tWidth of resulting image\n"); 48 fprintf(stderr, " -H, --height=HEIGHT\tHeight of resulting image\n"); 49 fprintf(stderr, " -d, --dither=DITHER\tDithering algorithm to use :\n"); 46 fprintf(stderr, " -h, --help\t\t\tThis help\n"); 47 fprintf(stderr, " -W, --width=WIDTH\t\tWidth of resulting image\n"); 48 fprintf(stderr, " -H, --height=HEIGHT\t\tHeight of resulting image\n"); 49 fprintf(stderr, " -b, --brightness=BRIGHTNESS\tBrightness of resulting image\n"); 50 fprintf(stderr, " -c, --contrast=CONTRAST\tContrast of resulting image\n"); 51 fprintf(stderr, " -g, --gamma=GAMMA\t\tGamma of resulting image\n"); 52 fprintf(stderr, " -d, --dither=DITHER\t\tDithering algorithm to use :\n"); 50 53 fprintf(stderr, "\t\t\tnone : Nearest color\n"); 51 54 fprintf(stderr, "\t\t\tordered2 : Ordered 2x2\n"); … … 54 57 fprintf(stderr, "\t\t\trandom : Random\n"); 55 58 fprintf(stderr, "\t\t\tfstein : Floyd Steinberg (default)\n"); 56 fprintf(stderr, " -f, --format=FORMAT\t Format of the resulting image :\n");59 fprintf(stderr, " -f, --format=FORMAT\t\tFormat of the resulting image :\n"); 57 60 fprintf(stderr, "\t\t\tansi : coulored ANSI (default)\n"); 58 61 fprintf(stderr, "\t\t\tcaca : internal libcaca format\n"); … … 77 80 char *format = NULL; 78 81 char *dither = NULL; 79 82 float gamma = -1, brightness = -1, contrast = -1; 80 83 81 84 if(argc < 2) … … 91 94 static struct myoption long_options[] = 92 95 { 93 { "width", 1, NULL, 'W' }, 94 { "height", 1, NULL, 'H' }, 95 { "format", 1, NULL, 'f' }, 96 { "dither", 1, NULL, 'd' }, 97 { "help", 0, NULL, 'h' }, 96 { "width", 1, NULL, 'W' }, 97 { "height", 1, NULL, 'H' }, 98 { "format", 1, NULL, 'f' }, 99 { "dither", 1, NULL, 'd' }, 100 { "gamma", 1, NULL, 'g' }, 101 { "brightness", 1, NULL, 'b' }, 102 { "contrast", 1, NULL, 'c' }, 103 { "help", 0, NULL, 'h' }, 98 104 }; 99 int c = mygetopt(argc, argv, "W:H:f:d: h", long_options, &option_index);105 int c = mygetopt(argc, argv, "W:H:f:d:g:b:c:h", long_options, &option_index); 100 106 if(c == -1) 101 107 break; … … 119 125 return 0; 120 126 break; 127 case 'g': /* --gamma */ 128 gamma = atof(myoptarg); 129 break; 130 case 'b': /* --brightness */ 131 brightness = atof(myoptarg); 132 break; 133 case 'c': /* --contrast */ 134 contrast = atof(myoptarg); 135 break; 121 136 default: 122 137 return 1; … … 167 182 return -1; 168 183 } 184 185 if(brightness!=-1) cucul_set_dither_brightness (i->dither, brightness); 186 if(contrast!=-1) cucul_set_dither_contrast (i->dither, contrast); 187 if(gamma!=-1) cucul_set_dither_gamma (i->dither, gamma); 188 169 189 cucul_dither_bitmap(cv, 0, 0, cols, lines, i->dither, i->pixels); 170 190
Note: See TracChangeset
for help on using the changeset viewer.