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

Size of compressed image is not follow the "maxSizeMB" options #226

Open
Darrenwwk opened this issue Dec 20, 2024 · 2 comments
Open

Size of compressed image is not follow the "maxSizeMB" options #226

Darrenwwk opened this issue Dec 20, 2024 · 2 comments

Comments

@Darrenwwk
Copy link

const imageCompressionOptions = { maxSizeMB: 0.3, };

await imageCompression( imgBlob as File, imageCompressionOptions, );

If image size is more than 2mb then I might get 400kb or 500kb size of compressed image.

@Darrenwwk Darrenwwk reopened this Dec 23, 2024
@Darrenwwk
Copy link
Author

const imageCompressionOptions = { maxSizeMB: 0.3, };

await imageCompression( imgBlob as File, imageCompressionOptions, );

If image size is more than 2mb then I might get 400kb or 500kb size of compressed image.

@QuillsB
Copy link

QuillsB commented Jan 10, 2025

Hey @Darrenwwk,
You can add maxIteration in your options.
The default value is 10 when not provided, set it to 20 for example and it will works fine 👍.

Be careful, because the bigger it is the longer the process can take.

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

2 participants