mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-25 13:18:22 +01:00
Merge "webpmux: add "-set bgcolor A,R,G,B"" into main
This commit is contained in:
commit
3368d8768a
11
README.mux
11
README.mux
@ -43,11 +43,12 @@ GET_OPTIONS:
|
||||
frame n get nth frame
|
||||
|
||||
SET_OPTIONS:
|
||||
Set color profile/metadata:
|
||||
loop LOOP_COUNT set the loop count
|
||||
icc file.icc set ICC profile
|
||||
exif file.exif set EXIF metadata
|
||||
xmp file.xmp set XMP metadata
|
||||
Set color profile/metadata/parameters:
|
||||
loop LOOP_COUNT set the loop count
|
||||
bgcolor BACKGROUND_COLOR set the animation background color
|
||||
icc file.icc set ICC profile
|
||||
exif file.exif set EXIF metadata
|
||||
xmp file.xmp set XMP metadata
|
||||
where: 'file.icc' contains the ICC profile to be set,
|
||||
'file.exif' contains the EXIF metadata to be set
|
||||
'file.xmp' contains the XMP metadata to be set
|
||||
|
@ -99,6 +99,7 @@ typedef enum {
|
||||
FEATURE_ANMF,
|
||||
FEATURE_DURATION,
|
||||
FEATURE_LOOP,
|
||||
FEATURE_BGCOLOR,
|
||||
LAST_FEATURE
|
||||
} FeatureType;
|
||||
|
||||
@ -315,11 +316,12 @@ static void PrintHelp(void) {
|
||||
|
||||
printf("\n");
|
||||
printf("SET_OPTIONS:\n");
|
||||
printf(" Set color profile/metadata:\n");
|
||||
printf(" loop LOOP_COUNT set the loop count\n");
|
||||
printf(" icc file.icc set ICC profile\n");
|
||||
printf(" exif file.exif set EXIF metadata\n");
|
||||
printf(" xmp file.xmp set XMP metadata\n");
|
||||
printf(" Set color profile/metadata/parameters:\n");
|
||||
printf(" loop LOOP_COUNT set the loop count\n");
|
||||
printf(" bgcolor BACKGROUND_COLOR set the animation background color\n");
|
||||
printf(" icc file.icc set ICC profile\n");
|
||||
printf(" exif file.exif set EXIF metadata\n");
|
||||
printf(" xmp file.xmp set XMP metadata\n");
|
||||
printf(" where: 'file.icc' contains the ICC profile to be set,\n");
|
||||
printf(" 'file.exif' contains the EXIF metadata to be set\n");
|
||||
printf(" 'file.xmp' contains the XMP metadata to be set\n");
|
||||
@ -778,6 +780,13 @@ static int ParseCommandLine(Config* config, const W_CHAR** const unicode_argv) {
|
||||
arg->params_ = argv[i + 1];
|
||||
++feature_arg_index;
|
||||
i += 2;
|
||||
} else if (!strcmp(argv[i], "bgcolor") &&
|
||||
(config->action_type_ == ACTION_SET)) {
|
||||
CHECK_NUM_ARGS_AT_LEAST(2, ErrParse);
|
||||
config->type_ = FEATURE_BGCOLOR;
|
||||
arg->params_ = argv[i + 1];
|
||||
++feature_arg_index;
|
||||
i += 2;
|
||||
} else { // Assume input file.
|
||||
if (config->input_ == NULL) {
|
||||
config->input_ = wargv[i];
|
||||
@ -1053,6 +1062,30 @@ static int Process(const Config* config) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FEATURE_BGCOLOR: {
|
||||
WebPMuxAnimParams params = { 0xFFFFFFFF, 0 };
|
||||
uint32_t bgcolor;
|
||||
ok = ParseBgcolorArgs(config->args_[0].params_, &bgcolor);
|
||||
if (!ok) {
|
||||
ERROR_GOTO1("ERROR: Could not parse the background color.\n",
|
||||
Err2);
|
||||
}
|
||||
ok = CreateMux(config->input_, &mux);
|
||||
if (!ok) goto Err2;
|
||||
ok = (WebPMuxGetAnimationParams(mux, ¶ms) == WEBP_MUX_OK);
|
||||
if (!ok) {
|
||||
ERROR_GOTO1("ERROR: input file does not seem to be an animation.\n",
|
||||
Err2);
|
||||
}
|
||||
params.bgcolor = bgcolor;
|
||||
err = WebPMuxSetAnimationParams(mux, ¶ms);
|
||||
ok = (err == WEBP_MUX_OK);
|
||||
if (!ok) {
|
||||
ERROR_GOTO2("ERROR (%s): Could not set animation parameters.\n",
|
||||
ErrorString(err), Err2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
ERROR_GOTO1("ERROR: Invalid feature for action 'set'.\n", Err2);
|
||||
break;
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.TH WEBPMUX 1 "December 12, 2020"
|
||||
.TH WEBPMUX 1 "November 3, 2021"
|
||||
.SH NAME
|
||||
webpmux \- create animated WebP files from non\-animated WebP images, extract
|
||||
frames from animated WebP images, and manage XMP/EXIF metadata and ICC profile.
|
||||
@ -82,6 +82,11 @@ Set loop count on an animated file.
|
||||
.P
|
||||
Where: 'loop_count' must be in range [0, 65535].
|
||||
.TP
|
||||
.BI bgcolor " A,R,G,B
|
||||
Set the background color of the canvas on an animated file.
|
||||
.P
|
||||
Where: 'loop_count' must be in range [0, 65535].
|
||||
.TP
|
||||
.BI icc " file.icc
|
||||
Set ICC profile.
|
||||
.P
|
||||
|
Loading…
Reference in New Issue
Block a user