From 1e595fe1e8bf47f81f4d0051720738c5011b9d8e Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 13 Aug 2015 20:54:02 -0700 Subject: [PATCH] dwebp: add -resize as a synonym for -scale -resize is used in cwebp for the same purpose Change-Id: I2756f3d23c4799fc9a10c4fe8c4c17057beebca9 --- examples/dwebp.c | 5 +++-- man/dwebp.1 | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/examples/dwebp.c b/examples/dwebp.c index 5785b483..4d95819f 100644 --- a/examples/dwebp.c +++ b/examples/dwebp.c @@ -549,7 +549,7 @@ static void Help(void) { " -alpha_dither use alpha-plane dithering if needed\n" " -mt .......... use multi-threading\n" " -crop ... crop output with the given rectangle\n" - " -scale .......... scale the output (*after* any cropping)\n" + " -resize ......... scale the output (*after* any cropping)\n" " -flip ........ flip the output vertically\n" " -alpha ....... only save the alpha plane\n" " -incremental . use incremental decoding (useful for tests)\n" @@ -627,7 +627,8 @@ int main(int argc, const char *argv[]) { config.options.crop_top = ExUtilGetInt(argv[++c], 0, &parse_error); config.options.crop_width = ExUtilGetInt(argv[++c], 0, &parse_error); config.options.crop_height = ExUtilGetInt(argv[++c], 0, &parse_error); - } else if (!strcmp(argv[c], "-scale") && c < argc - 2) { + } else if ((!strcmp(argv[c], "-scale") || !strcmp(argv[c], "-resize")) && + c < argc - 2) { // '-scale' is left for compatibility config.options.use_scaling = 1; config.options.scaled_width = ExUtilGetInt(argv[++c], 0, &parse_error); config.options.scaled_height = ExUtilGetInt(argv[++c], 0, &parse_error); diff --git a/man/dwebp.1 b/man/dwebp.1 index 5741be6a..0e7cd985 100644 --- a/man/dwebp.1 +++ b/man/dwebp.1 @@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH DWEBP 1 "June 13, 2014" +.TH DWEBP 1 "August 13, 2015" .SH NAME dwebp \- decompress a WebP file to an image file .SH SYNOPSIS @@ -90,11 +90,13 @@ Note: the cropping is applied \fIbefore\fP any scaling. .B \-flip Flip decoded image vertically (can be useful for OpenGL textures for instance). .TP -.BI \-scale " width height +\fB\-resize\fR, \fB\-scale\fI width height\fR Rescale the decoded picture to dimension \fBwidth\fP x \fBheight\fP. This option is mostly intended to reducing the memory needed to decode large images, -when only a small version is needed (thumbnail, preview, etc.). Note: scaling +when only a small version is needed (thumbnail, preview, etc.). Note: scaling is applied \fIafter\fP cropping. +If either (but not both) of the \fBwidth\fP or \fBheight\fP parameters is 0, +the value will be calculated preserving the aspect-ratio. .TP .B \-v Print extra information (decoding time in particular).