question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cropped image dimensions by 30% is like 5% less size on memory

See original GitHub issue

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 !!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jwagnercommented, May 19, 2021

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.

1reaction
jwagnercommented, May 18, 2021

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 <canvas>. It doesn’t do image compression either.

Could you provide a bit more background on what you mean?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Image Resize, Part 2 Details of Cropping, Resampling, Scaling
4x5 or 8x10 shapes are a little wider and less long, so to speak. Shape and size are different properties. Images are easily...
Read more >
Part 2: Scale and Crop Images - SERC - Carleton
Two common solutions are scaling the images down and cropping them to a smaller size. Scaling, Interpolation, and Spatial Calibration. Scaling ...
Read more >
How to Resize an Image [from Any Device] - Alphr
1. Open one of your favorite browsers and visit TinyWow.com. 2. Hover your mouse to the Image tab and click Resize Image Dimension...
Read more >
Website Image Size Guidelines Cheat Sheet (2023) - Shopify
The main methods include using the right image sizes to begin with (pixels and memory size), and using online image-optimizer tools.
Read more >
How to Resize and Reduce Photo File Size on iPhone or iPad ...
Do you want to crop, resize and reduce the photo file size that you took from your iPhone? You can compress the image...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found