|
|
@ -17,7 +17,6 @@ const int FLAG_BG = 2;
|
|
|
|
const int FLAG_MODE_256 = 4;
|
|
|
|
const int FLAG_MODE_256 = 4;
|
|
|
|
const int FLAG_24BIT = 8;
|
|
|
|
const int FLAG_24BIT = 8;
|
|
|
|
const int FLAG_NOOPT = 16;
|
|
|
|
const int FLAG_NOOPT = 16;
|
|
|
|
const int FLAG_SAVE = 32;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const int COLOR_STEP_COUNT = 6;
|
|
|
|
const int COLOR_STEP_COUNT = 6;
|
|
|
|
const int COLOR_STEPS[COLOR_STEP_COUNT] = {0, 0x5f, 0x87, 0xaf, 0xd7, 0xff};
|
|
|
|
const int COLOR_STEPS[COLOR_STEP_COUNT] = {0, 0x5f, 0x87, 0xaf, 0xd7, 0xff};
|
|
|
@ -419,7 +418,6 @@ void emit_usage() {
|
|
|
|
std::cerr << " -help : Display this help text." << std::endl;
|
|
|
|
std::cerr << " -help : Display this help text." << std::endl;
|
|
|
|
std::cerr << " -h <num> : Set the maximum height to <num> lines." << std::endl;
|
|
|
|
std::cerr << " -h <num> : Set the maximum height to <num> lines." << std::endl;
|
|
|
|
std::cerr << " -w <num> : Set the maximum width to <num> characters." << std::endl << std::endl;
|
|
|
|
std::cerr << " -w <num> : Set the maximum width to <num> characters." << std::endl << std::endl;
|
|
|
|
std::cerr << " -o <name> : Output file name." << std::endl << std::endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum Mode {AUTO, THUMBNAILS, FULL_SIZE};
|
|
|
|
enum Mode {AUTO, THUMBNAILS, FULL_SIZE};
|
|
|
@ -444,18 +442,12 @@ cimg_library::CImg<unsigned char> load_rgb_CImg(const char * const filename) {
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
struct winsize w;
|
|
|
|
struct winsize w;
|
|
|
|
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
|
|
|
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
|
|
|
|
|
|
|
|
|
|
|
//If redirect STDOUT to one file ( col and row == 0 )
|
|
|
|
|
|
|
|
if(w.ws_col == 0 && w.ws_row == 0) {
|
|
|
|
|
|
|
|
ioctl(0, TIOCGWINSZ, &w);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int maxWidth = w.ws_col * 4;
|
|
|
|
int maxWidth = w.ws_col * 4;
|
|
|
|
int maxHeight = w.ws_row * 8;
|
|
|
|
int maxHeight = w.ws_row * 8;
|
|
|
|
int flags = 0;
|
|
|
|
int flags = 0;
|
|
|
|
Mode mode = AUTO;
|
|
|
|
Mode mode = AUTO;
|
|
|
|
int columns = 3;
|
|
|
|
int columns = 3;
|
|
|
|
std::string output_file;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> file_names;
|
|
|
|
std::vector<std::string> file_names;
|
|
|
|
int error = 0;
|
|
|
|
int error = 0;
|
|
|
@ -469,9 +461,6 @@ int main(int argc, char* argv[]) {
|
|
|
|
std::string arg(argv[i]);
|
|
|
|
std::string arg(argv[i]);
|
|
|
|
if (arg == "-0") {
|
|
|
|
if (arg == "-0") {
|
|
|
|
flags |= FLAG_NOOPT;
|
|
|
|
flags |= FLAG_NOOPT;
|
|
|
|
} else if (arg == "-o") {
|
|
|
|
|
|
|
|
output_file = argv[++i];
|
|
|
|
|
|
|
|
flags |= FLAG_SAVE;
|
|
|
|
|
|
|
|
} else if (arg == "-c") {
|
|
|
|
} else if (arg == "-c") {
|
|
|
|
columns = std::stoi(argv[++i]);
|
|
|
|
columns = std::stoi(argv[++i]);
|
|
|
|
} else if (arg == "-d") {
|
|
|
|
} else if (arg == "-d") {
|
|
|
@ -501,9 +490,7 @@ int main(int argc, char* argv[]) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((flags & FLAG_SAVE) != 0) {
|
|
|
|
|
|
|
|
freopen(output_file.c_str(),"w",stdout);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mode == FULL_SIZE || (mode == AUTO && file_names.size() == 1)) {
|
|
|
|
if (mode == FULL_SIZE || (mode == AUTO && file_names.size() == 1)) {
|
|
|
|
for (unsigned int i = 0; i < file_names.size(); i++) {
|
|
|
|
for (unsigned int i = 0; i < file_names.size(); i++) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|