onurzorluer / react-image-file-resizer

Resize Local Images with React 🌄 🌅
MIT License
313 stars 41 forks source link

Quality not affecting PNG format #84

Open vladikdx opened 1 year ago

vladikdx commented 1 year ago

When setting the compressed format to PNG no matter what quality value you are writing it's just not changing the URI compressed file size result. Have anyone faced that issue?

const resizeFile = (file) =>
  new Promise((resolve) => {
    Resizer.imageFileResizer(
      file,
      300,
      300,
      "PNG",
      1,
      0,
      (uri) => {
        resolve(uri);
      },
      "file"
    );
  });
yohann84L commented 1 year ago

That's because you cannot compress PNG as it is a lossless format. Use instead JPEG or WEBP