mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 13:48:21 +01:00
Add support for "no blend" in webpmux binary
Change-Id: I6d07b120626317df73f1a6f026931c5b9485a340
This commit is contained in:
parent
3b80bc4859
commit
e81fac86dd
@ -56,11 +56,12 @@ STRIP_OPTIONS:
|
|||||||
|
|
||||||
FRAME_OPTIONS(i):
|
FRAME_OPTIONS(i):
|
||||||
Create animation.
|
Create animation.
|
||||||
file_i +di+xi+yi+mi
|
file_i +di+[xi+yi[+mi[bi]]]
|
||||||
where: 'file_i' is the i'th animation frame (WebP format),
|
where: 'file_i' is the i'th animation frame (WebP format),
|
||||||
'di' is the pause duration before next frame.
|
'di' is the pause duration before next frame.
|
||||||
'xi','yi' specify the image offset for this frame.
|
'xi','yi' specify the image offset for this frame.
|
||||||
'mi' is the dispose method for this frame (0 or 1).
|
'mi' is the dispose method for this frame (0 or 1).
|
||||||
|
'bi' is the blending method for this frame (+b or -b).
|
||||||
|
|
||||||
LOOP_COUNT:
|
LOOP_COUNT:
|
||||||
Number of times to repeat the animation.
|
Number of times to repeat the animation.
|
||||||
|
@ -228,14 +228,17 @@ static WebPMuxError DisplayInfo(const WebPMux* mux) {
|
|||||||
if (nFrames > 0) {
|
if (nFrames > 0) {
|
||||||
int i;
|
int i;
|
||||||
printf("No.: x_offset y_offset ");
|
printf("No.: x_offset y_offset ");
|
||||||
if (is_anim) printf("duration dispose ");
|
if (is_anim) printf("duration dispose blend ");
|
||||||
printf("image_size\n");
|
printf("image_size\n");
|
||||||
for (i = 1; i <= nFrames; i++) {
|
for (i = 1; i <= nFrames; i++) {
|
||||||
WebPMuxFrameInfo frame;
|
WebPMuxFrameInfo frame;
|
||||||
err = WebPMuxGetFrame(mux, i, &frame);
|
err = WebPMuxGetFrame(mux, i, &frame);
|
||||||
if (err == WEBP_MUX_OK) {
|
if (err == WEBP_MUX_OK) {
|
||||||
printf("%3d: %8d %8d ", i, frame.x_offset, frame.y_offset);
|
printf("%3d: %8d %8d ", i, frame.x_offset, frame.y_offset);
|
||||||
if (is_anim) printf("%8d %7d ", frame.duration, frame.dispose_method);
|
if (is_anim) {
|
||||||
|
printf("%8d %7d %5d", frame.duration, frame.dispose_method,
|
||||||
|
frame.blend_method);
|
||||||
|
}
|
||||||
printf("%10d\n", (int)frame.bitstream.size);
|
printf("%10d\n", (int)frame.bitstream.size);
|
||||||
}
|
}
|
||||||
WebPDataClear(&frame.bitstream);
|
WebPDataClear(&frame.bitstream);
|
||||||
@ -333,11 +336,13 @@ static void PrintHelp(void) {
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
printf("FRAME_OPTIONS(i):\n");
|
printf("FRAME_OPTIONS(i):\n");
|
||||||
printf(" Create animation.\n");
|
printf(" Create animation.\n");
|
||||||
printf(" file_i +di+xi+yi+mi\n");
|
printf(" file_i +di+[xi+yi[+mi[bi]]]\n");
|
||||||
printf(" where: 'file_i' is the i'th animation frame (WebP format),\n");
|
printf(" where: 'file_i' is the i'th animation frame (WebP format),\n");
|
||||||
printf(" 'di' is the pause duration before next frame.\n");
|
printf(" 'di' is the pause duration before next frame.\n");
|
||||||
printf(" 'xi','yi' specify the image offset for this frame.\n");
|
printf(" 'xi','yi' specify the image offset for this frame.\n");
|
||||||
printf(" 'mi' is the dispose method for this frame (0 or 1).\n");
|
printf(" 'mi' is the dispose method for this frame (0 or 1).\n");
|
||||||
|
printf(" 'bi' is the blending method for this frame (+b or -b)."
|
||||||
|
"\n");
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("LOOP_COUNT:\n");
|
printf("LOOP_COUNT:\n");
|
||||||
@ -414,24 +419,33 @@ static int WriteWebP(WebPMux* const mux, const char* filename) {
|
|||||||
|
|
||||||
static int ParseFrameArgs(const char* args, WebPMuxFrameInfo* const info) {
|
static int ParseFrameArgs(const char* args, WebPMuxFrameInfo* const info) {
|
||||||
int dispose_method, dummy;
|
int dispose_method, dummy;
|
||||||
const int num_args = sscanf(args, "+%d+%d+%d+%d+%d",
|
char plus_minus, blend_method;
|
||||||
&info->duration, &info->x_offset, &info->y_offset,
|
const int num_args = sscanf(args, "+%d+%d+%d+%d%c%c+%d", &info->duration,
|
||||||
&dispose_method, &dummy);
|
&info->x_offset, &info->y_offset, &dispose_method,
|
||||||
|
&plus_minus, &blend_method, &dummy);
|
||||||
switch (num_args) {
|
switch (num_args) {
|
||||||
case 1:
|
case 1:
|
||||||
info->x_offset = info->y_offset = 0; // fall through
|
info->x_offset = info->y_offset = 0; // fall through
|
||||||
case 3:
|
case 3:
|
||||||
dispose_method = 0; // fall through
|
dispose_method = 0; // fall through
|
||||||
case 4:
|
case 4:
|
||||||
|
plus_minus = '+';
|
||||||
|
blend_method = 'b'; // fall through
|
||||||
|
case 6:
|
||||||
break;
|
break;
|
||||||
|
case 2:
|
||||||
|
case 5:
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// Note: The sanity of the following conversion is checked by
|
// Note: The sanity of the following conversion is checked by
|
||||||
// WebPMuxSetAnimationParams().
|
// WebPMuxPushFrame().
|
||||||
info->dispose_method = (WebPMuxAnimDispose)dispose_method;
|
info->dispose_method = (WebPMuxAnimDispose)dispose_method;
|
||||||
// TODO(urvang): Add support for parsing blending method too.
|
|
||||||
info->blend_method = WEBP_MUX_BLEND;
|
if (blend_method != 'b') return 0;
|
||||||
|
if (plus_minus != '-' && plus_minus != '+') return 0;
|
||||||
|
info->blend_method =
|
||||||
|
(plus_minus == '+') ? WEBP_MUX_BLEND : WEBP_MUX_NO_BLEND;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
.\" Hey, EMACS: -*- nroff -*-
|
.\" Hey, EMACS: -*- nroff -*-
|
||||||
.TH WEBPMUX 1 "March 16, 2013"
|
.TH WEBPMUX 1 "August 26, 2013"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
webpmux \- command line tool to create WebP Mux/container file.
|
webpmux \- command line tool to create WebP Mux/container file.
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -92,12 +92,14 @@ Strip XMP metadata.
|
|||||||
|
|
||||||
.SS FRAME_OPTIONS (\-frame)
|
.SS FRAME_OPTIONS (\-frame)
|
||||||
.TP
|
.TP
|
||||||
.I file_i +di[+xi+yi[+mi]]
|
.I file_i +di[+xi+yi[+mi[bi]]]
|
||||||
Where: 'file_i' is the i'th frame (WebP format), 'xi','yi' specify the image
|
Where: 'file_i' is the i'th frame (WebP format), 'xi','yi' specify the image
|
||||||
offset for this frame, 'di' is the pause duration before next frame and 'mi' is
|
offset for this frame, 'di' is the pause duration before next frame, 'mi' is
|
||||||
the dispose method for this frame (0 for NONE or 1 for BACKGROUND).
|
the dispose method for this frame (0 for NONE or 1 for BACKGROUND) and 'bi' is
|
||||||
'mi' can be omitted and will default to 0 (NONE).
|
the blending method for this frame (+b for BLEND or -b for NO_BLEND).
|
||||||
Additionally, if 'mi' is ommitted then'xi' and 'yi' can be omitted and will
|
Argument 'bi' can be omitted and will default to +b (BLEND).
|
||||||
|
Also, 'mi' can be omitted if 'bi' is omitted and will default to 0 (NONE).
|
||||||
|
Finally, if 'mi' and 'bi' are omitted then 'xi' and 'yi' can be omitted and will
|
||||||
default to +0+0.
|
default to +0+0.
|
||||||
.TP
|
.TP
|
||||||
.BI \-loop " n
|
.BI \-loop " n
|
||||||
@ -149,10 +151,13 @@ webpmux \-get exif exif_container.webp \-o image_metadata.exif
|
|||||||
.br
|
.br
|
||||||
webpmux \-strip exif exif_container.webp \-o without_exif.webp
|
webpmux \-strip exif exif_container.webp \-o without_exif.webp
|
||||||
.br
|
.br
|
||||||
webpmux \-frame anim_1.webp +100 \-frame anim_2.webp +100+50+50 \-loop 10
|
webpmux \-frame anim_1.webp +100 \-frame anim_2.webp +100+50+50
|
||||||
.br
|
.br
|
||||||
.RS 8
|
.RS 8
|
||||||
\-bgcolor 255,255,255,255 \-o anim_container.webp
|
\-frame anim_2.webp +100+50+50+1+b \-loop 10 \-bgcolor 255,255,255,255
|
||||||
|
.br
|
||||||
|
.RS 8
|
||||||
|
\-o anim_container.webp
|
||||||
.RE
|
.RE
|
||||||
.br
|
.br
|
||||||
webpmux \-get frame 2 anim_container.webp \-o frame_2.webp
|
webpmux \-get frame 2 anim_container.webp \-o frame_2.webp
|
||||||
|
Loading…
Reference in New Issue
Block a user