image-webpack-loader icon indicating copy to clipboard operation
image-webpack-loader copied to clipboard

Wrong images encoding with 3.4.0

Open alex-shamshurin opened this issue 7 years ago • 10 comments

Safari 10.1 cannot read some embedded PNG images with the same config as for v. 3.3.1. Wrong encoding or something else.

      {
        test: /(^((?!-bg).)*png$|^((?!-bg).)*jpe?g$|^((?!-bg).)*gif$|^((?!-bg).)*svg$)$/i,
        use: [
          {
            loader: 'url-loader',
            options: {
              hash: 'sha512',
              digest: 'hex',
              name: '[name].[ext]?[hash]',
              limit: 250000,
            },
          },
          {
            loader: 'image-webpack-loader',
            options: {
              pngquant: {
                quality: '65-90',
                speed: 4,
                optimizationLevel: 7,
                interlaced: false,
              },
              mozjpeg: {
                quality: 65,
              },
            },
          },
        ],
      },

All image processing libs are at the same versions as it were with image-webpack-loader v3.3.1 Only downgrading to 3.3.1 helps.

Under chrome it's ok.

alex-shamshurin avatar Aug 30 '17 11:08 alex-shamshurin

I have the same issue

TinaZbh avatar Aug 31 '17 07:08 TinaZbh

Same here, will now downgrade to 3.3. Only on Safari / macOs or IOS. Even with no options the images will not be ok. Other browsers no problems.

Remco75 avatar Aug 31 '17 08:08 Remco75

Same issue. Downgraded to 3.3.1. Fixed issue for Safari and Firefox. Otherwise, jpegs and pngs were errored images.

codylindley avatar Aug 31 '17 16:08 codylindley

can you try with 3.4.1?

tcoopman avatar Sep 03 '17 14:09 tcoopman

The issue is still present with 3.4.1. It is because the file is now a webp image instead of a png image and thus a duplicate of the various other open issues / pull requests relating to this.

$ file e4614c15661b2b934ec6ffa4c1dbcf00.png 
e4614c15661b2b934ec6ffa4c1dbcf00.png: RIFF (little-endian) data, Web/P image

Other issues:

  • https://github.com/tcoopman/image-webpack-loader/issues/111
  • https://github.com/tcoopman/image-webpack-loader/issues/112
  • https://github.com/tcoopman/image-webpack-loader/pull/114
  • https://github.com/tcoopman/image-webpack-loader/pull/115

thmsobrmlr avatar Sep 05 '17 08:09 thmsobrmlr

#115 will make the webp optimizer optional, as it should have been. Sorry for any inconvenience this may have caused!

adrienharnay avatar Sep 05 '17 08:09 adrienharnay

Same issue. You can turn webp.enabled as false to fix this problem.

loaders: [
  'image-webpack?{webp:{enabled: false}}'
]

By default, image-webpack-loader will push imageminWebp into plugins.

// index.js line 78
if(options.webp.enabled !== false)
  plugins.push(imageminWebp(options.webp));

moyus avatar Sep 07 '17 07:09 moyus

You are referring to outdated code. Please update to 3.4.2

adrienharnay avatar Sep 07 '17 08:09 adrienharnay

I'm still seeing this with 3.4.2.

markwoon avatar Sep 17 '17 07:09 markwoon

I take it back, 3.4.2 fixes this, but make sure you remove the previous hack (webp.enabled = false).

markwoon avatar Sep 17 '17 07:09 markwoon