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: Port image types detections from PIL to the imghdr module
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.5
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: Claudiu.Popa, coldmind, effbot, iritkatriel, pythonhacker, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2014-05-25 09:37 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
issue21574.patch coldmind, 2014-10-02 20:32 Port 10 new formats; some improvements review coldmind, 2014-10-02 20:32 Test images
Messages (11)
msg219078 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-05-25 09:37
It would be good to add support of all image types which are supported in PIL to the imghdr module.
msg219079 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2014-05-25 09:40
Sounds good, I'll create a patch.
msg224002 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-07-25 20:59
Claudiu, are you working on this issue? If not, I'll start writing a patch.
msg224005 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2014-07-25 21:54
No, I didn't start any work on this and right now, with EuroPython, I don't have that much time to start, so feel free to take it and write a patch.
msg228063 - (view) Author: Andriy Sokolovskiy (coldmind) * Date: 2014-10-01 08:35
I'll try to do this issue.
msg228255 - (view) Author: Andriy Sokolovskiy (coldmind) * Date: 2014-10-02 20:32
Hi! Here is first version of patch. What I've done:
* Ported 10 new image formats from PIL (tests included)
* Improved existing file detections like PIL does.
* Add some byte manipulation routines

One more thing - I removed `ord()` calls, because python3 expects unicode symbol,
but bytes was provided, and I'm not sure is that right. Will these changes be included to python 3.5 only?

Here are some other image formats in PIL, that I didn't port, because they are so excotic, that I didn't find
even file examples. I can do this blindly, but I think without tests files this is useless.
What community think about this?
msg237663 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2015-03-09 15:37
In general, the patch looks good, I left a couple of comments on Rietvld. It should be applied to 3.5 only. Also, there are some image test files which aren't included in this patch, could you update it to include them? Thanks.
msg237768 - (view) Author: Andriy Sokolovskiy (coldmind) * Date: 2015-03-10 14:20
@Claudiu Popa, IIRC I did not add 1-2 test images because I not found how to make image or how to convert image to this format.
So, if there will no chance to add them, should we remove these formats from the patch?
msg238079 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2015-03-14 11:41
Well, we should have test files for each format imghdr supports. Doesn't PIL have test files for them?
msg348629 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-07-29 11:44
This issue is 5 years old and has patches: it is no newcomer friendly, I remove the "easy" keyword.
msg415046 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-03-13 17:15
imghdr is deprecated as per PEP 594, so there won't be further enhancements to it.
Date User Action Args
2022-04-11 14:58:04adminsetgithub: 65773
2022-03-13 17:15:04iritkatrielsetstatus: open -> closed

nosy: + iritkatriel
messages: + msg415046

resolution: wont fix
stage: test needed -> resolved
2019-07-29 11:44:13vstinnersetkeywords: - easy
nosy: + vstinner
messages: + msg348629

2015-04-19 19:23:32Claudiu.Popasetstage: needs patch -> test needed
2015-03-14 11:41:03Claudiu.Popasetmessages: + msg238079
2015-03-10 18:19:26pythonhackersetnosy: + pythonhacker
2015-03-10 14:20:43coldmindsetmessages: + msg237768
2015-03-09 15:37:51Claudiu.Popasetmessages: + msg237663
2014-10-02 20:32:30coldmindsetfiles: +
2014-10-02 20:32:05coldmindsetfiles: + issue21574.patch
keywords: + patch
messages: + msg228255
2014-10-01 08:35:48coldmindsetnosy: + coldmind
messages: + msg228063
2014-07-25 21:54:41Claudiu.Popasetmessages: + msg224005
2014-07-25 20:59:49serhiy.storchakasetmessages: + msg224002
2014-05-25 09:40:21Claudiu.Popasetmessages: + msg219079
2014-05-25 09:37:01serhiy.storchakacreate