Skip to content

Commit

Permalink
Add -c option
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Apr 18, 2017
1 parent e42eca8 commit b894cf1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/catimg.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ int main(int argc, char *argv[])
opterr = 0;

uint32_t cols = 0, precision = 0;
while ((c = getopt (argc, argv, "w:l:r:h")) != -1)
uint8_t convert = 0;
while ((c = getopt (argc, argv, "w:l:r:hc")) != -1)
switch (c) {
case 'w':
cols = strtol(optarg, &num, 0) >> 1;
Expand All @@ -81,6 +82,10 @@ int main(int argc, char *argv[])
case 'h':
printf(USAGE);
exit(0);
break;
case 'c':
convert = 1;
break;
default:
printf(USAGE);
exit(1);
Expand Down Expand Up @@ -108,7 +113,8 @@ int main(int argc, char *argv[])
float sc = cols/(float)img.width;
img_resize(&img, sc, sc);
}
/* img_convert_colors(&img); */
if (convert)
img_convert_colors(&img);
/*printf("Loaded %s: %ux%u. Console width: %u\n", file, img.width, img.height, cols);*/
// For GIF
if (img.frames > 1) {
Expand Down

0 comments on commit b894cf1

Please sign in to comment.