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

Image size restriction increases file size #138

Open
SridharRamasami opened this issue May 14, 2018 · 4 comments
Open

Image size restriction increases file size #138

SridharRamasami opened this issue May 14, 2018 · 4 comments
Labels

Comments

@SridharRamasami
Copy link

Hi,
Im using the image size restrictions as below
var userOptions = {
enableImageSizeRestrictions: true,
imageMaxWidth: 500,
imageMaxHeight: 500
}

When the input is a jpg of 700x525px with a file size of 265kb the output is a png of 599x375px and a file size of 467.8kb
Node version 9.10.1
Ubuntu16

This error has occured in different version of node and different versions of Ubuntu.

If you need any further information, please let me know.

@spreadred
Copy link

@SridharRamasami I assume this is occurring using my fork, as image resize is not implemented in original repo?

@SridharRamasami
Copy link
Author

Hi Kaptain,
Yes. Im using your fork. Looks like base 64 increases the size when converted from binary. Also browsers do not compress the image efficiently.
Any work arounds you can think of?

@SridharRamasami
Copy link
Author

Worked around it by asking it to return a jpg instead of a png. Works well now.
return fc.toDataURL("image/jpeg", 0.8);

Not sure whether to call it a bug or not. Maintainers, feel free to close this if you think its not.

@spreadred
Copy link

@SridharRamasami Thanks for reporting this issue and providing a workaround. At this point I'd say it is certainly unintended behavior, but perhaps not a bug. I never bothered to check on the resulting file size of the images after resizing. I will look into this and perform some further tests with images of different resolutions before determining how I'd like to resolve the issue.

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

No branches or pull requests

3 participants