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

Does not resize PNG image as expected under certain conditions #134

Closed
zehawki opened this issue Sep 11, 2021 · 4 comments
Closed

Does not resize PNG image as expected under certain conditions #134

zehawki opened this issue Sep 11, 2021 · 4 comments

Comments

@zehawki
Copy link

zehawki commented Sep 11, 2021

Describe the bug
Does not resize an image

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://fengyuanchen.github.io/compressorjs/
  2. Use the image from https://www.transparentpng.com/download/happy-st-patricks-day-_34433.html
  3. Set maxWidth to 1035px or higher
  4. Image wont resize

Expected behavior
Should resize to 1035px or higher

Screenshots
image

Additional context
Any maxWidth < 1035px correctly resizes the image.

This same kind of behavior is seen with different images, with different values of maxWidth. This library is unexpectedly buggy.

@fengyuanchen
Copy link
Owner

For your case, you may need to set the strict option to false.

@zehawki
Copy link
Author

zehawki commented Sep 20, 2021

Nope, there is something really wrong here. I'm trying with another PNG image that is ~3000 x 4000 px. Asking for maxWidth = 2500 blows up the image size massively.

image

@fengyuanchen
Copy link
Owner

This is why the strict option should be set to true by default, as it is hard to compress PNG images.

@fengyuanchen
Copy link
Owner

For compressing PNG images:

  • Set the mimeType option to image/jpeg.
  • Or set the convertSize option to a small value.

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