Merge pull request #36 from SDWebImage/fix_max_file_size_passes

Fix that the max file size encoding need to increase the passes used by libwebp, we choose to use 6 from cwebp command line
This commit is contained in:
DreamPiggy 2020-04-07 19:46:38 +08:00 committed by GitHub
commit e25194e655
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -781,6 +781,7 @@ static CGSize SDCalculateThumbnailSize(CGSize fullSize, BOOL preserveAspectRatio
}
config.target_size = (int)fileSize; // Max filesize for output, 0 means use quality instead
config.pass = fileSize > 0 ? 6 : 1; // Use 6 passes for file size limited encoding, which is the default value of `cwebp` command line
config.thread_level = 1; // Thread encoding for fast
config.lossless = 0; // Disable lossless encoding (If we need, can add new Encoding Options in future version)
picture.use_argb = config.lossless; // Lossy encoding use YUV for internel bitstream