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

Keep Metadata #164

Closed
mwc2016 opened this issue Oct 19, 2022 · 3 comments
Closed

Keep Metadata #164

mwc2016 opened this issue Oct 19, 2022 · 3 comments

Comments

@mwc2016
Copy link

mwc2016 commented Oct 19, 2022

Might I know that how to keep the metadata during compression image

@sscholle
Copy link

sscholle commented Feb 8, 2023

like the 'lastModified' date?

@mwc2016
Copy link
Author

mwc2016 commented Feb 9, 2023

like the 'lastModified' date?

Yup, like below information

Screenshot 2023-02-09 at 12 59 20 PM

@Donaldcwl
Copy link
Owner

added option preserveExif in v2.0.1 to enabled this feature
e.g.,

const options = {
  maxSizeMB: 1,
  maxWidthOrHeight: 1920,
  useWebWorker: true,
  preserveExif: true,
}
try {
  const compressedFile = await imageCompression(imageFile, options);
  console.log('compressedFile instanceof Blob', compressedFile instanceof Blob); // true
  console.log(`compressedFile size ${compressedFile.size / 1024 / 1024} MB`); // smaller than maxSizeMB

  await uploadToServer(compressedFile); // write your own logic
} catch (error) {
  console.log(error);
}

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

3 participants