浏览代码

优化图像压缩功能的参数设置- 将最大迭代次数从5次增加到15次,以提高压缩精度
- 将最小质量阈值从0.01降低到0.001,

tianyun 8 月之前
父节点
当前提交
7a8fae2e43
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      simple-demo/webp.html

+ 1 - 1
simple-demo/webp.html

@@ -55,7 +55,7 @@
     });
 
 
-    function compressImageToSize(blobFile, targetSize = 300 * 1024, maxIterations = 5, minQuality = 0.01) {
+    function compressImageToSize(blobFile, targetSize = 300 * 1024, maxIterations = 15, minQuality = 0.001) {
         let currentQuality = 0.8; // 初始压缩质量
         let iteration = 0; // 当前迭代次数
         function compressImage(blobFile, quality = 0.8) {