[Django] #37041: get_image_dimensions ignores exif roration

3 views
Skip to first unread message

Django

unread,
Apr 17, 2026, 6:32:31 AM (yesterday) Apr 17
to django-...@googlegroups.com
#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.

Django

unread,
Apr 17, 2026, 9:26:43 AM (yesterday) Apr 17
to django-...@googlegroups.com
#37041: get_image_dimensions ignores exif roration
-------------------------------------+-------------------------------------
Reporter: Johannes Maron | Owner: (none)
Type: Uncategorized | Status: closed
Component: File | Version: dev
uploads/storage |
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* resolution: => duplicate
* status: new => closed

Comment:

Duplicate of #34035,
--
Ticket URL: <https://code.djangoproject.com/ticket/37041#comment:1>
Reply all
Reply to author
Forward
0 new messages