Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PNG Not compressing to the max Size specified #176

Open
mdayeen opened this issue Jan 14, 2023 · 5 comments
Open

PNG Not compressing to the max Size specified #176

mdayeen opened this issue Jan 14, 2023 · 5 comments

Comments

@mdayeen
Copy link

mdayeen commented Jan 14, 2023

PNG files are not being compress to size specified.

@Donaldcwl
Copy link
Owner

@mdayeen Can you provide the config you use and the image as a zip file?

@imtiazShakil
Copy link

I face the same issue, png file compression doesn't respect maxSizeMB limit. here is my configuration:

{
          maxSizeMB: 0.5,
          maxWidthOrHeight: 1200,
          alwaysKeepResolution: true,
}

@imtiazShakil
Copy link

if I increase the maxIteration to 100, then it works. For png images the default 10 iterations is not enough

@imtiazShakil
Copy link

imtiazShakil commented May 1, 2024

image

the sample png image:
SamplePNGImage_5mbmb

@anish-anantharaman
Copy link

@imtiazShakil I tried adding the maxIterations parameter as 100. However I am facing the same issue. It is not getting compressed. I am using browser-image-compression version 0.0.1. Any ideas are welcome. Thank you

const options = {
useWebWorker: true,
maxSizeMB: 2,
initialQuality: 0.7, // Lower initial quality to reduce file size
maxIterations: 100
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants