-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtempviewer.cpp
45 lines (40 loc) · 851 Bytes
/
tempviewer.cpp
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <gmic.h>
#include <sys/stat.h>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char **argv) {
struct stat sb;
gmic interpreter;
gmic_list<float> images;
gmic_list<char> names;
string buffer;
int i;
for(i = 1;argv[i];++i) {
buffer += ' ';
buffer += argv[i];
if (stat(argv[i], &sb) == -1)
continue;
else if (sb.st_size == 76800)
buffer += ",160,120";
else if (sb.st_size == 19200)
buffer += ",80,60";
}
if(i > 1) {
buffer += " -d";
try {
interpreter.run(buffer.c_str(), images, names);
} catch (gmic_exception &e) {
fprintf(stderr,"ERROR: %s\n", e.what());
}
}
while(!cin.eof()) {
cout << "> ";
getline(cin, buffer);
try {
interpreter.run(buffer.c_str(), images, names);
} catch (gmic_exception &e) {
fprintf(stderr,"ERROR: %s\n", e.what());
}
}
}