Giter VIP home page Giter VIP logo

Comments (4)

jongbonga avatar jongbonga commented on July 27, 2024

did you set imageQuality to 100? The default is set to 90

from ngx-image-cropper.

EricKrief avatar EricKrief commented on July 27, 2024

Now I have, still no luck.
Is there some kind of image smoothing algorithm? Can I disable it?

from ngx-image-cropper.

lucas-implanta avatar lucas-implanta commented on July 27, 2024

That's a interesting question, because I have noticed when I upload a image to the cropper, it actually increases significantly the image size, I was running some tests with a image that has 3.5MB, and the output after using the image cropper was a image with 9MB!

Is this behavior intentional? It makes me wonder why it almost triplicated the file size, kinda looks like it does have endeed some algorithm applied to the image when it's emitted 🤔

*Edit:

It seems that, using [imageQuality] and set the value to around 90, and set the [format] to "jpeg" (I was using "png"), you can control the image quality and try to balance between size and quality, now the image with 3.5MB outputs to less than 1MB 😳

I think it's all about the png format, by definition, png images are heavier than jpeg ones, so if anyone is facing this problem, consider tweaking these settings.

from ngx-image-cropper.

Mawi137 avatar Mawi137 commented on July 27, 2024

Seems like there is an option for that on the HTML canvas: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled

Feel free to add it as an option.

The reason the size increases is because the HTML canvas outputs a base64 string which is no compressed. It contains the data for each pixel. Using jpeg helps a lot with the file size. Using blob as output might help as well.

from ngx-image-cropper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.