首页 > 解决方案 > 为什么我的图像在 Webpack 中被超压缩?

问题描述

我正在使用带有文件加载器的 image-webpack-loader。尽管我在 pngquant 上使用了“90-100”指数,但我的 png 图像被释放得非常轻且质量很差。目前我的 png_background 有 892 字节!以及上述指标的质量如此差。

这是我的配置:

  // images
  {
    test: /\.(gif|png|jpe?g|svg)$/i,
    use: [
      'file-loader',
      {
        loader: 'image-webpack-loader',
        options: {
          mozjpeg: {
            progressive: true,
            quality: 65
          },
          // optipng.enabled: false will disable optipng
          optipng: {
            enabled: true,
          },
          pngquant: {
            quality: '90-100',
          },
          gifsicle: {
            interlaced: false,
          },
          // the webp option will enable WEBP
          webp: {
            quality: 75
          }
        }
      },
    ],
  }

我尝试过使用它一些,但我的图像仍然是超压缩的。我想知道为什么会这样?任何提示都会很棒,谢谢

标签: webpack

解决方案


推荐阅读