#37041: get_image_dimensions ignores exif roration
-------------------------------------+-------------------------------------
Reporter: Johannes Maron | Type:
| Uncategorized
Status: new | Component: File
| uploads/storage
Version: dev | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Hi there!
While working on an unrelated update on django-pictures, I noticed that
get_image_dimensions ignores the EXIF rotation of an image.
Now, is this intended or not? I could make an argument both ways. However,
when you display an image in a browser (likely with Django) , browsers
will rotate the image by default; see also:
https://developer.mozilla.org
/en-US/docs/Web/CSS/Reference/Properties/image-orientation
So, if those values are used anywhere, like in the width/height attribute
on an `img` tag (like it's happening in django-pictures). They will be
“wrong.”
Now, the question is, should `get_image_dimensions` return the pixel
dimension or the visual dimension of the image?
My advice: Let's do both and provide an explicit option. When using the
function or the width/height fields, let's allow users to provide an
option. We can keep the default as is and avoid a breaking change. Maybe
deprecate the default in favor of an explicit user choice.
Cheers!
Joe
--
Ticket URL: <
https://code.djangoproject.com/ticket/37041>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.