Closed YukihoAA closed 5 years ago
Note: loosy webp limit is different depends on image.
cv::Mat output = imread("testin.png", cv::IMREAD_UNCHANGED);
int imwrite_params[] =
{
cv::IMWRITE_WEBP_QUALITY,
90,
cv::IMWRITE_JPEG_QUALITY,
90,
cv::IMWRITE_PNG_COMPRESSION,
5
};
std::vector<int> compression_params;
for (int i = 0; i < 6; i++)
{
compression_params.push_back(imwrite_params[i]);
}
cv::imwrite("testout.webp", output, compression_params);
from: https://developers.google.com/speed/webp/docs/riff_container
lossless webp is recommended by webp standard. if user wants lossy format, use jpg is best option.
webp is lossless by default, and user expect webp is lossless too. but jpeg is lossy format so user can predict jpeg quality is not 100
so I changed webp to lossless mode in default. user always can use lossy if they want.
also, jpeg default is still 90.
MERGE AFTER #170
Finally.
as my commit crashed png, jpgs so i need to work at this problem lol
It took 1 Month to fix from #122 to #169 lol
finally i finished my work so,, ready to merge!
I limit webp output to 16383 because it is limit of webp size,
also I limited lossy webp output size to 14000 because lossy webp output size limit is arount 14000~14500
fixes #169, #149