compressorjs
compressorjs copied to clipboard
feat: add `retainExif` option to retain Exif
Summary
What kind of change does this PR introduce? (check at least one)
- [ ] Bugfix
- [x] Feature
- [ ] Code style update
- [ ] Refactor
- [ ] Docs
- [ ] Build-related changes
- [ ] Other, please describe:
If changing the UI of the default theme, please provide the before/after screenshot:
Does this PR introduce a breaking change? (check one)
- [ ] Yes
- [x] No
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
- [ ] When resolving a specific issue, it's referenced in the PR's title (e.g.
fix #xxx[,#xxx]
, where "xxx" is the issue number)
You have tested in the following browsers: (Providing a detailed version will be better.)
- [x] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Edge
- [ ] IE
If adding a new feature, the PR's description includes:
- [x] A convincing reason for adding this feature
- [x] Related documents have been updated
- [x] Related tests have been updated
To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.
Other information:
By default, the Exif information will be lost in the compressed image. If you want to keep the Exif information of the original image you can set the retainExif
option to true
Reference 使用CANVAS压缩JPG图片丢失EXIF信息问题 .
Is it necessary to add this feature? This is a question that requires careful consideration.
In fact, you can read Exif metadata on the browser side and upload it to the server side as a parameter along with the compressed image.
@fengyuanchen Thanks for the reply. In my case, I use this lib to build a browser-side image compress website, I hope that the users can choose whether or not to retain the Exif when they save the compressed image.
Hey this feature will be very helpful. It can save a lot of time.
@fengyuanchen I would like to ask for this feature to be merged too. Having the image and the metadata divided adds a few challenges, first of all keeping them linked and consistent.
Indeed, it would be useful to at least have the option to chose since it doesn't impact the code to much
I was looking for this feature and I would love to see this merged. If the purpose of this library is to compress images client-side, I don't see why you shouldn't have an option to keep the metadata.
News on this?
Any updates?
Just a related comment. It would be amazing if this option (or similar option) could also retain IPTC data (caption, copyright, keywords etc). I believe the goal is to be able to compress images, while keeping ALL image meta data, as this is largely beneficial for image galleries etc when uploading and compressing images.