mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 22:28:22 +01:00
add a -quiet option to 'dwebp'
(useful for tests) Change-Id: Ia07f407bc1e819a1d3cab64a02317d058733261b
This commit is contained in:
parent
80ab3edb94
commit
41a5d99d55
1
README
1
README
@ -279,6 +279,7 @@ Use following options to convert into alternate image formats:
|
|||||||
-incremental . use incremental decoding (useful for tests)
|
-incremental . use incremental decoding (useful for tests)
|
||||||
-h ....... this help message
|
-h ....... this help message
|
||||||
-v ....... verbose (e.g. print encoding/decoding times)
|
-v ....... verbose (e.g. print encoding/decoding times)
|
||||||
|
-quiet ....... quiet mode, don't print anything
|
||||||
-noasm ....... disable all assembly optimizations
|
-noasm ....... disable all assembly optimizations
|
||||||
|
|
||||||
Visualization tool:
|
Visualization tool:
|
||||||
|
@ -555,6 +555,7 @@ static void Help(void) {
|
|||||||
" -incremental . use incremental decoding (useful for tests)\n"
|
" -incremental . use incremental decoding (useful for tests)\n"
|
||||||
" -h ....... this help message\n"
|
" -h ....... this help message\n"
|
||||||
" -v ....... verbose (e.g. print encoding/decoding times)\n"
|
" -v ....... verbose (e.g. print encoding/decoding times)\n"
|
||||||
|
" -quiet ....... quiet mode, don't print anything\n"
|
||||||
#ifndef WEBP_DLL
|
#ifndef WEBP_DLL
|
||||||
" -noasm ....... disable all assembly optimizations\n"
|
" -noasm ....... disable all assembly optimizations\n"
|
||||||
#endif
|
#endif
|
||||||
@ -569,6 +570,7 @@ int main(int argc, const char *argv[]) {
|
|||||||
int ok = 0;
|
int ok = 0;
|
||||||
const char *in_file = NULL;
|
const char *in_file = NULL;
|
||||||
const char *out_file = NULL;
|
const char *out_file = NULL;
|
||||||
|
int quiet = 0;
|
||||||
|
|
||||||
WebPDecoderConfig config;
|
WebPDecoderConfig config;
|
||||||
WebPDecBuffer* const output_buffer = &config.output;
|
WebPDecBuffer* const output_buffer = &config.output;
|
||||||
@ -603,6 +605,8 @@ int main(int argc, const char *argv[]) {
|
|||||||
format = BMP;
|
format = BMP;
|
||||||
} else if (!strcmp(argv[c], "-tiff")) {
|
} else if (!strcmp(argv[c], "-tiff")) {
|
||||||
format = TIFF;
|
format = TIFF;
|
||||||
|
} else if (!strcmp(argv[c], "-quiet")) {
|
||||||
|
quiet = 1;
|
||||||
} else if (!strcmp(argv[c], "-version")) {
|
} else if (!strcmp(argv[c], "-version")) {
|
||||||
const int version = WebPGetDecoderVersion();
|
const int version = WebPGetDecoderVersion();
|
||||||
printf("%d.%d.%d\n",
|
printf("%d.%d.%d\n",
|
||||||
@ -665,6 +669,8 @@ int main(int argc, const char *argv[]) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (quiet) verbose = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
VP8StatusCode status = VP8_STATUS_OK;
|
VP8StatusCode status = VP8_STATUS_OK;
|
||||||
size_t data_size = 0;
|
size_t data_size = 0;
|
||||||
@ -721,13 +727,16 @@ int main(int argc, const char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (out_file != NULL) {
|
if (out_file != NULL) {
|
||||||
|
if (!quiet) {
|
||||||
fprintf(stderr, "Decoded %s. Dimensions: %d x %d %s. Format: %s. "
|
fprintf(stderr, "Decoded %s. Dimensions: %d x %d %s. Format: %s. "
|
||||||
"Now saving...\n",
|
"Now saving...\n",
|
||||||
in_file, output_buffer->width, output_buffer->height,
|
in_file, output_buffer->width, output_buffer->height,
|
||||||
bitstream->has_alpha ? " (with alpha)" : "",
|
bitstream->has_alpha ? " (with alpha)" : "",
|
||||||
kFormatType[bitstream->format]);
|
kFormatType[bitstream->format]);
|
||||||
|
}
|
||||||
ok = SaveOutput(output_buffer, format, out_file);
|
ok = SaveOutput(output_buffer, format, out_file);
|
||||||
} else {
|
} else {
|
||||||
|
if (!quiet) {
|
||||||
fprintf(stderr, "File %s can be decoded "
|
fprintf(stderr, "File %s can be decoded "
|
||||||
"(dimensions: %d x %d %s. Format: %s).\n",
|
"(dimensions: %d x %d %s. Format: %s).\n",
|
||||||
in_file, output_buffer->width, output_buffer->height,
|
in_file, output_buffer->width, output_buffer->height,
|
||||||
@ -736,6 +745,7 @@ int main(int argc, const char *argv[]) {
|
|||||||
fprintf(stderr, "Nothing written; "
|
fprintf(stderr, "Nothing written; "
|
||||||
"use -o flag to save the result as e.g. PNG.\n");
|
"use -o flag to save the result as e.g. PNG.\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Exit:
|
Exit:
|
||||||
WebPFreeDecBuffer(output_buffer);
|
WebPFreeDecBuffer(output_buffer);
|
||||||
return ok ? 0 : -1;
|
return ok ? 0 : -1;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
.\" Hey, EMACS: -*- nroff -*-
|
.\" Hey, EMACS: -*- nroff -*-
|
||||||
.TH DWEBP 1 "August 13, 2015"
|
.TH DWEBP 1 "August 17, 2015"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
dwebp \- decompress a WebP file to an image file
|
dwebp \- decompress a WebP file to an image file
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -98,6 +98,9 @@ is applied \fIafter\fP cropping.
|
|||||||
If either (but not both) of the \fBwidth\fP or \fBheight\fP parameters is 0,
|
If either (but not both) of the \fBwidth\fP or \fBheight\fP parameters is 0,
|
||||||
the value will be calculated preserving the aspect-ratio.
|
the value will be calculated preserving the aspect-ratio.
|
||||||
.TP
|
.TP
|
||||||
|
.B \-quiet
|
||||||
|
Do not print anything.
|
||||||
|
.TP
|
||||||
.B \-v
|
.B \-v
|
||||||
Print extra information (decoding time in particular).
|
Print extra information (decoding time in particular).
|
||||||
.TP
|
.TP
|
||||||
|
Loading…
Reference in New Issue
Block a user