-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Problem with file size #536
Comments
Hi, PNG is a lot larger than JPG format. If you look at the syntax of toBlob (or toDataURL though that's not recommended) it can take 3 arguments |
I'm having the same issue. Changing to JPEG with |
@IDavidCP is the image coming out larger than expected? Are you on a retina device like a macbook? If you put |
Hi, PNG is a lot larger than JPG format. If you look at the syntax of toBlob (or toDataURL though that's not recommended) it can take 3 arguments toBlob(callback, type, quality) so you can do toBlob(callback, 'image/jpeg', 1) you can also lower the quality of the jpeg e.g. toBlob(callback, 'image/jpeg', 0.8) for 80% quality. Thank you, it works! |
@dominictobias Yes, the image is coming out larger than expected. I'm not using retina device and function toBlob(canvas: HTMLCanvasElement): Promise<Blob | null> {
return new Promise((resolve) => {
canvas.toBlob(resolve, 'image/jpeg', 0.8)
})
} Original image: .jpg 900x900 100kb |
Hello everyone
Perhaps someone has encountered a similar problem.
How to solve the problem, so that the format of the image after cropping does not change, and the file size does not increase?
input: jpeg file size 1920x1280 / 239kb
output: png file size 1917x1078 / 2.36mb
The text was updated successfully, but these errors were encountered: