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

Cropper shows image squished if image has non zero EXIF rotation and application uses image-orientation: none #685

Open
Egor-Chib opened this issue Jun 18, 2020 · 4 comments

Comments

@Egor-Chib
Copy link

Egor-Chib commented Jun 18, 2020

If image EXIF include rotation and application uses "image-orientation: none" then image will be shown in cropper squished, cropper messing up / swapping image height and width.
Windows 10, Browsers: FF & Chrome

In our application we use
image, img {
image-orientation: none;
}
We use images with and without EXIF information. EXIF information sometimes includes image rotation - this is the case when we have trouble. Images without EXIF and images with EXIF but without rotation seems to be ok,

We and our customers have this problem and it is critical for our business.

I have it debugged.

The problem caused by using naturalWidth and naturalHeight HTML5 image properties.

This is one of the consequences of changed default value of "image-orientation" style attribute from "none" to "from-image". Browsers FF and Chromium.

Now when cropper requesting "natural" attributes of the image with non zero rotation in EXIF and image under "image-orientation: none" browser provide wrong information.

We used this image file for testing:
Frm Essense

Expected behavior: image appear in cropper editor with correct aspect ratio/proportions

Actual behavior: on screenshot you can see, that cropper assign width to height and height to width, image looks super wide, squished,

image-2020-06-10-10-09-25-624

@fengyuanchen
Copy link
Owner

Currently, for browsers that support the image-orientation property, you should NOT set it to none, but from-image.

@fengyuanchen
Copy link
Owner

Or you might remove the Exif Orientation info before applying to the Cropper.js.

@Egor-Chib
Copy link
Author

Thanks. You suggested good bug workaround and I am aware of it.

Would you, please, advise if there are some ETA for this bug fix?

@fengyuanchen
Copy link
Owner

I still have not a good idea or solution for this currently. I still search for a well cross-browser solution about image-orientation. Thanks!

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