classification
Title: Port image types detections from PIL to the imghdr module
Type: enhancement Stage: test needed
Components: Library (Lib) Versions: Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Claudiu.Popa, coldmind, effbot, pythonhacker, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2014-05-25 09:37 by serhiy.storchaka, last changed 2019-07-29 11:44 by vstinner.

Files
File name Uploaded Description Edit
issue21574.patch coldmind, 2014-10-02 20:32 Port 10 new formats; some improvements review
issue21574.zip coldmind, 2014-10-02 20:32 Test images
Messages (10)
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: Claudiu Popa (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: Claudiu Popa (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.
https://mail.python.org/mailman/private/core-mentorship/2014-October/002766.html
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: Claudiu Popa (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: Claudiu Popa (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.
History
Date User Action Args
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: + issue21574.zip
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