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] keep the same width and height, and reduce the quality only #127

Closed
GeekaholicLin opened this issue Nov 23, 2021 · 1 comment

Comments

@GeekaholicLin
Copy link

Thanks for the awesome library for the image compression!

I noticed that the width/height of the image will be reduced to meet the maxSizeMB.

Is it possible to provide the option to keep the same width and height of the original image file and reduce the quality only?

https://github.com/Donaldcwl/browser-image-compression/blob/master/lib/image-compression.js#L95-L96

Donaldcwl added a commit that referenced this issue Apr 12, 2022
…nd reduce the quality only

options.alwaysKeepResolution (default: false) - keep the resolution (width and height) during
compression and reduce the quality only (note that options.maxWidthOrHeight is still applied if set)
[#127](#127)

re #127
Donaldcwl added a commit that referenced this issue Apr 12, 2022
…nd reduce the quality only

options.alwaysKeepResolution (default: false) - keep the resolution (width and height) during
compression and reduce the quality only (note that options.maxWidthOrHeight is still applied if set)

re #127
Donaldcwl added a commit that referenced this issue Apr 12, 2022
…nd reduce the quality only

options.alwaysKeepResolution (default: false) - keep the resolution (width and height) during
compression and reduce the quality only (note that options.maxWidthOrHeight is still applied if set)

re #127
Donaldcwl added a commit that referenced this issue Apr 12, 2022
…nd reduce the quality only

options.alwaysKeepResolution (default: false) - keep the resolution (width and height) during
compression and reduce the quality only (note that options.maxWidthOrHeight is still applied if set)

re #127
@Donaldcwl Donaldcwl mentioned this issue Apr 12, 2022
@Donaldcwl
Copy link
Owner

v2.0.0 added options.alwaysKeepResolution, for example:

const options = {
    maxSizeMB: 1,
    useWebWorker: true,
    alwaysKeepResolution: true,
  }
  const compressedFile = await imageCompression(imageFile, options);

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

No branches or pull requests

2 participants