This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: imghdr add openexr support
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Claudiu.Popa, SilentGhost, berker.peksag, mvignali, python-dev, r.david.murray, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2014-01-18 18:45 by mvignali, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
img_hdr_exr.patch mvignali, 2014-01-18 18:45 add test_exr func to imghdr review
img_hdr_exr_2.patch mvignali, 2014-01-19 10:21 review
img_hdr_exr_3.patch mvignali, 2014-01-19 20:18 avoid IndexError Exception. review
issue20295.patch Claudiu.Popa, 2014-06-19 15:10 review
Messages (9)
msg208409 - (view) Author: Martin Vignali (mvignali) Date: 2014-01-18 18:45
Add support for detect openexr file (
Based on information provided by :

I make some tests, on different kind of exr file, to check, the new function.
msg208467 - (view) Author: Martin Vignali (mvignali) Date: 2014-01-19 10:21
New patch with formatting correction and documentation update.

I'm not sure about the place of the versionadded directive in the documentation.
msg208472 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2014-01-19 10:52
Martin, it would be better if you do the check the way it's done in test_rast: h.startswith(b'\x76\x2f\x31\x01')

Otherwise, you need to check that that h has at least 4 elements (if it doesn't you'll get an IndexError).
msg208498 - (view) Author: Martin Vignali (mvignali) Date: 2014-01-19 20:18
You're right, i make the correction, in a new patch.

I make other tests, with official sample files :
msg208499 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2014-01-19 20:23
Hi, Martin.

Please see issue19990, which tries to add unit tests for imghdr module. It would be nice if you could expand on it with an exr file, for your use case.
msg220991 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2014-06-19 15:10
Here's an updated patch with a small exr test file.
msg221485 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2014-06-24 20:02
This seems commit ready.
msg221616 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-06-26 16:28
New changeset 71b9a841119a by R David Murray in branch 'default':
#20295: Teach imghdr to recognize OpenEXR format images.
msg221617 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-06-26 16:30
Thanks, Martin and Claudiu.
Date User Action Args
2022-04-11 14:57:57adminsetgithub: 64494
2014-06-26 16:30:03r.david.murraysetstatus: open -> closed
resolution: fixed
messages: + msg221617

stage: commit review -> resolved
2014-06-26 16:28:38python-devsetnosy: + python-dev
messages: + msg221616
2014-06-25 13:17:41Claudiu.Popasetnosy: + r.david.murray
2014-06-24 20:02:58Claudiu.Popasetmessages: + msg221485
stage: patch review -> commit review
2014-06-19 15:10:07Claudiu.Popasetfiles: + issue20295.patch

messages: + msg220991
2014-01-21 15:07:19berker.peksagsetnosy: + serhiy.storchaka
2014-01-19 20:23:14Claudiu.Popasetnosy: + Claudiu.Popa
messages: + msg208499
2014-01-19 20:18:51mvignalisetfiles: + img_hdr_exr_3.patch

messages: + msg208498
2014-01-19 10:52:05SilentGhostsetnosy: + SilentGhost
messages: + msg208472
2014-01-19 10:21:16mvignalisetfiles: + img_hdr_exr_2.patch

messages: + msg208467
2014-01-19 06:19:34berker.peksagsetnosy: + berker.peksag
stage: patch review

versions: + Python 3.5, - Python 3.4
2014-01-18 18:45:46mvignalicreate