-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
30 lines (24 loc) · 743 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include "quantization.h"
int main(int argc, char **argv) {
char *filename;
int k, maxIterations;
if (argc < 3) {
puts("Error: not enough informations\n");
puts("usage: ./quantize filename colors [MAX_ITERATIONS]\n");
puts("positional arguments:");
puts(" filename\t\tthe name of the png file");
puts(" colors\t\tnumber of colors\n");
puts("optional arguments:");
puts(" MAX_ITERATIONS\t\tmaximum number of iterations");
return 0;
}
filename = argv[1];
k = atoi(argv[2]);
if (argc < 4) maxIterations = INT_MAX;
else maxIterations = atoi(argv[3]);
quantize(filename, k, maxIterations);
return 0;
}