gpt4 book ai didi

webpack - 如何使用 webpack "tinypng way"压缩 jpeg 图像?

转载 作者:行者123 更新时间:2023-12-04 18:00:06 38 4
gpt4 key购买 nike

我正在使用 image-webpack-loader压缩图像。它适用于 png 图像,但几乎不能压缩 jpeg 图像。

示例 1:

  • 原始 PNG 文件:124 kb
  • 加载程序结果:25 kb
  • Tinypng 结果:23 kb

  • 示例 2:
  • 原始 JPG 文件:567 kb
  • 加载程序结果:563 kb
  • Tinypng 结果:146 kb

  • 图像加载器配置: 'image-webpack?{bypassOnDebug: true, progressive: true, optimizationLevel: 1, interlaced: true, pngquant:{quality: 100, nofs: true}}'
    如何使用 jpg 图像接近 tinypng 结果?

    最佳答案

    根据文档你需要增加optimizationLevel到更高的值(例如 5):

    The optimization level 0 enables a set of optimization operations that require minimal effort. There will be no changes to image attributes like bit depth or color type, and no recompression of existing IDAT datastreams. The optimization level 1 enables a single IDAT compression trial.

    关于webpack - 如何使用 webpack "tinypng way"压缩 jpeg 图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36665036/

    38 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com