-
Notifications
You must be signed in to change notification settings - Fork 87
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
feat: retain metadata after image compression #5800
Conversation
Any news from upstream on this one @foochifa ? |
Oh yes @timotheeg ! The package was just released earlier this week, sorry have been busy with the payment issues. Though there is one issue that may arise from this: Compressorjs does not have a max_size paramter. Hence, even after compression (only for Png files, Jpeg will still work) it may still be quite large. Was testing a png file that compresses from just 2.6MB to 1.1MB even after dropping quality and width/height to 1440 (this is also quite rare, after testing about 8 png files (of size 1-13.1), it only happened for one specific png). Thats why I have added error checking, to check if:
Also the metadata only works for jpeg files currently too haha there isn't any good package to handle metadata for png files (even though exif should have been integrated in 2017) I have 4 options for this:
Current implementation is option 3 |
Some cool things I have found too:
|
using this for testing purposes, will update when retainExif feature is officially released
This reverts commit 5b168f78e0a114d91fa4b5d8635adbaa320d7ec4.
fad3315
to
c01f333
Compare
instead of the default 5MB
CLOSING THIS our current Will open a separate PR to bump browser-image-compression and enable the preserve exif flag |
Awesome! Thanks @foochifa ! |
Problem
In React, the image compression library that we currently use, browser-image-compression, does not retain EXIF metadata of images, as it strips the data before compressing it with html canvas.
As some of our users rely on image metadata, this feature will help retain their workflow even if submission size of images is large. Our previous version in angularjs retains this metadata.
Closes #5754
Solution
Replace the image compression library with compressorjs
Breaking Changes
Features:
EXIF data of JPEG images will now be preserved even after compression.
Before & After Screenshots
BEFORE:
AFTER:
Tests
New dependencies:
compressorjs
: javascript lossy and async image compressor using the browser's canvas.toBlob API