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

Notes about checkOrientation #156

Open
mjau-mjau opened this issue Aug 15, 2022 · 3 comments
Open

Notes about checkOrientation #156

mjau-mjau opened this issue Aug 15, 2022 · 3 comments

Comments

@mjau-mjau
Copy link

mjau-mjau commented Aug 15, 2022

This is not strictly a bug, but I wanted to post some important pitfalls in regards to the checkOrientation option. I have worked with photo.gallery and files.gallery for 10+ years, and have lots of experience with the challenges of EXIF-oriented images in website photo galleries.

  1. First of all, checkOrientation set to false does not seem to work. From my tests, it is ALWAYS rotates the image from EXIF value, even when set to false. I don't actually see how anyone would want to set it to false, but my tests show it always rotates according to EXIF. Could it be a browser thing? Because the image might get rotated from CSS image-orientation from-image as this is now default in most browsers. I am guessing the blob is already rotated.
  2. Even if checkOrientation could be disabled, who would want that? If someone uploads an EXIF-oriented image and Compressor.js deletes the image's EXIF data, the image will become incorrectly rotated with no way to retrieve the true orientation of the image.
  3. The ultimate resolution, would of course be to write EXIF back into the image like jQuery-file-upload does https://github.com/blueimp/JavaScript-Load-Image#exif-parser. This would of course be favorable in most cases when one wants to retain all other EXIF data from images also.

I'm not sure if this is worth of a bug, but the whole concept of checkOrientation in Compressor.js is a bug. When disabled (if it works), it will simply cause incorrectly rotated images as soon as Compressor.js removes the EXIF. I can't see any thinkable scenario where this would be useful.

This is also request to consider writing EXIF back into images after compression. EXIF is a crucial feature for photo gallery type websites, and users ultimately want compression/resize without sacrificing EXIF. I know that EXIF orientation and writing EXIF back into images are complicated matters, but I thought I'd post.

@fengyuanchen
Copy link
Owner

The first version of Compressor.js was released on December 10, 2018. At that time, most browsers did not support the image-orientation CSS property, which meant that the checkOrientation option worked fine.

@mjau-mjau
Copy link
Author

mjau-mjau commented Aug 20, 2022

Understood. But then surely the option can be removed to avoid confusion? For 95% of browsers, it simply has no effect, which at best is confusing. Besides, even if it did work to set checkOrientation false, this will simply break images with EXIF rotation when EXIF is removed by compressorjs. Thanks

@fengyuanchen
Copy link
Owner

This option may be removed in the next major version. Thanks for your suggestion.

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