tweaking...
This commit is contained in:
parent
393112fb9b
commit
6dc9aab6ba
@ -12,7 +12,7 @@
|
||||
int verbosity;
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
int faire_un_halfsize(char *iname, char *oname, int notused)
|
||||
int faire_un_halfsize(char *iname, char *oname, int to_gray)
|
||||
{
|
||||
FloatImg src, dst;
|
||||
int foo;
|
||||
@ -30,6 +30,11 @@ if (foo) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (to_gray) {
|
||||
foo = fimg_to_gray(&dst);
|
||||
|
||||
}
|
||||
|
||||
foo = fimg_dump_to_file(&dst, oname, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "save to '%s' -> %d\n", oname, foo);
|
||||
@ -48,13 +53,15 @@ void help(int u)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int foo, opt, action;
|
||||
int foo, opt;
|
||||
|
||||
char *srcname = "";
|
||||
char *dstname = "out.fimg";
|
||||
int grayed = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "hv")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "ghv")) != -1) {
|
||||
switch(opt) {
|
||||
case 'g': grayed = 1; break;
|
||||
case 'h': help(0); break;
|
||||
case 'v': verbosity++; break;
|
||||
}
|
||||
@ -68,10 +75,12 @@ if (2 != argc-optind) {
|
||||
srcname = argv[optind];
|
||||
dstname = argv[optind+1];
|
||||
|
||||
fprintf(stderr, "%s: optind: %d src: %s dst: %s\n", argv[0], optind,
|
||||
if (verbosity) {
|
||||
fprintf(stderr, "%s: src: %s dst: %s\n", argv[0],
|
||||
srcname, dstname);
|
||||
}
|
||||
|
||||
foo = faire_un_halfsize(srcname, dstname, 0);
|
||||
foo = faire_un_halfsize(srcname, dstname, grayed);
|
||||
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user