gif2webp: only write error messages to stderr

also output something if -o is not given, but the process succeeded

Change-Id: I466c377f0cbf8c9f45bb1839191b04dada9c5f0f
This commit is contained in:
James Zern 2013-03-17 18:08:01 -07:00
parent 59423a2486
commit 723847d5d7

View File

@ -343,10 +343,10 @@ int main(int argc, const char *argv[]) {
goto End;
}
if (verbose) {
fprintf(stderr, "Added frame %dx%d (offset:%d,%d duration:%d) ",
printf("Added frame %dx%d (offset:%d,%d duration:%d) ",
view.width, view.height, frame.x_offset, frame.y_offset,
frame.duration);
fprintf(stderr, "dispose:%d transparent index:%d\n",
printf("dispose:%d transparent index:%d\n",
frame.dispose_method, transparent_index);
}
WebPDataClear(&frame.bitstream);
@ -392,7 +392,7 @@ int main(int argc, const char *argv[]) {
if (data == NULL) goto End; // Loop count sub-block missing.
if (data[0] != 3 && data[1] != 1) break; // wrong size/marker
anim.loop_count = data[2] | (data[3] << 8);
if (verbose) fprintf(stderr, "Loop count: %d\n", anim.loop_count);
if (verbose) printf("Loop count: %d\n", anim.loop_count);
} else if (!memcmp(data + 1, "XMP dataXMP", 11)) {
// Read XMP metadata.
WebPData xmp;
@ -401,7 +401,7 @@ int main(int argc, const char *argv[]) {
xmp.bytes = (uint8_t*)data;
xmp.size = data[0] + 1;
WebPMuxSetChunk(mux, "XMP ", &xmp, 1);
if (verbose) fprintf(stderr, "XMP size: %zu\n", xmp.size);
if (verbose) printf("XMP size: %zu\n", xmp.size);
} else if (!memcmp(data + 1, "ICCRGBG1012", 11)) {
// Read ICC profile.
WebPData icc;
@ -410,7 +410,7 @@ int main(int argc, const char *argv[]) {
icc.bytes = (uint8_t*)data;
icc.size = data[0] + 1;
WebPMuxSetChunk(mux, "ICCP", &icc, 1);
if (verbose) fprintf(stderr, "ICC size: %zu\n", icc.size);
if (verbose) printf("ICC size: %zu\n", icc.size);
}
break;
}
@ -454,7 +454,13 @@ int main(int argc, const char *argv[]) {
fprintf(stderr, "Error writing output file: %s\n", out_file);
goto End;
}
if (!quiet) fprintf(stderr, "Saved output file: %s\n", out_file);
if (!quiet) {
printf("Saved output file: %s\n", out_file);
}
} else {
if (!quiet) {
printf("Nothing written; use -o flag to save the result.\n");
}
}
// All OK.