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
Cropped image dimensions by 30% is like 5% less size on memory #106
Comments
I wished size would drop relatively as smartcrop is intended also for optimizing size. that would be great ! |
Hi @bacloud14, I'm not sure what you mean. smartcrop.js does not do anything to image quality nor does it do image compression - or anything else - to the image. It just gives you candidate crops. The test suite just draws on . It doesn't do image compression either. Could you provide a bit more background on what you mean? |
ok, I tried that "guitarist.jpg" file, cropped with The result image of type 'png' with these observations:
while I thought Something near : ((250 * 250) / (427 * 640)) * 170 = 38.87 KB |
Like when you take a paper, crop it with scissors, the amount of paper is always the same relatively to size. |
You are really comparing apples and oranges here. PNG and JPEG compress data differently. PNG is generally a quite bad choice to compress photographs. Maybe https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types#choosing_an_image_format or https://www.freecodecamp.org/news/best-image-format-for-web-in-2019-jpeg-webp-heic-avif-41ba0c1b2789/ help you understand that a bit better. But that really doesn't have anything to do with smartcrop. Smartcrop doesn't produce jpegs or pngs - it just gives you crops. |
Probably I mistakenly change the name of the output file to PNG. |
note: I know the main purpose of this, is to smart crop, and this is already great. Still I have another problem
Context
I want to use this amazing library for uploads in browser. I tried to grab code from testsuite and it works fine.
Unfortunately I find in most cases:
Problem
cropped size in px / original size in px
is always way less than
cropped size in mb / original size in mb
I wished smartcrop.js would let the image quality as is, in this case I think size on memory would drop relatively to the cropped size ( logically as images are raw data? ).
Thanks a lot !!
The text was updated successfully, but these errors were encountered: