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

Feature Request: controllable "quality" field #78

Closed
ndanvers opened this issue Oct 28, 2020 · 2 comments
Closed

Feature Request: controllable "quality" field #78

ndanvers opened this issue Oct 28, 2020 · 2 comments

Comments

@ndanvers
Copy link

Hello there and thank you for this wonderful package.

Current Behavior:
Within image-compression.js, the quality is set via:
let quality = 1

It is further affected in the case of a jpeg:

if (file.type === 'image/jpeg') {
      quality *= 0.95
    }

Desired Behavior
Ability to input a quality field in the options passed to browser-image-compressor, like so:

let options = {
        maxSizeMB: 2,
        maxWidthOrHeight: 2048, 
        quality: 0.5
}

reasoning
I believe that there are certain use cases where it would be extremely useful to have more control over this.

Thank you again

@Donaldcwl
Copy link
Owner

Donaldcwl commented Nov 8, 2020

Added initialQuality options in v1.0.13
e.g.:

const options = {
        maxSizeMB: 2,
        maxWidthOrHeight: 2048, 
        initialQuality: 0.5
}

Thank you

@ndanvers
Copy link
Author

ndanvers commented Nov 9, 2020

Fantastic, thank you for this addition.

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

No branches or pull requests

2 participants