gif2webp: Add '-min-size' option to get best compression.

This disables key-frame insertion and tries both dispose methods for
each frame.

Change-Id: Ib167747198fd1d98cb93321f76826e91228f24d8
This commit is contained in:
Urvang Joshi
2014-10-30 15:17:09 -07:00
parent 77bdddf016
commit 7489b0e72b
4 changed files with 30 additions and 4 deletions

View File

@ -231,6 +231,10 @@ static void Help(void) {
" or lossless compression heuristically\n");
printf(" -q <float> ............. quality factor (0:small..100:big)\n");
printf(" -m <int> ............... compression method (0=fast, 6=slowest)\n");
printf(" -min_size .............. minimize output size (default:off)\n"
" lossless compression by default; can be\n"
" combined with -q, -m, -lossy or -mixed\n"
" options\n");
printf(" -kmin <int> ............ min distance between key frames\n");
printf(" -kmax <int> ............ max distance between key frames\n");
printf(" -f <int> ............... filter strength (0=off..100)\n");
@ -274,6 +278,7 @@ int main(int argc, const char *argv[]) {
int stored_icc = 0; // Whether we have already stored an ICC profile.
int stored_xmp = 0;
int minimize_size = 0;
int default_kmin = 1; // Whether to use default kmin value.
int default_kmax = 1;
size_t kmin = 0;
@ -307,6 +312,8 @@ int main(int argc, const char *argv[]) {
config.quality = ExUtilGetFloat(argv[++c], &parse_error);
} else if (!strcmp(argv[c], "-m") && c < argc - 1) {
config.method = ExUtilGetInt(argv[++c], 0, &parse_error);
} else if (!strcmp(argv[c], "-min_size")) {
minimize_size = 1;
} else if (!strcmp(argv[c], "-kmax") && c < argc - 1) {
kmax = ExUtilGetUInt(argv[++c], 0, &parse_error);
default_kmax = 0;
@ -466,7 +473,7 @@ int main(int argc, const char *argv[]) {
WebPUtilClearPic(&frame, NULL);
// Initialize cache.
cache = WebPFrameCacheNew(frame.width, frame.height,
cache = WebPFrameCacheNew(frame.width, frame.height, minimize_size,
kmin, kmax, allow_mixed);
if (cache == NULL) goto End;