[issue16512] imghdr doesn't support jpegs with an ICC profile

2014-06-12 Thread Kovid Goyal
Kovid Goyal added the comment: FYI, the test I currently use in calibre, which has not failed so far for millions of users: def test_jpeg(h, f): if (h[6:10] in (b'JFIF', b'Exif')) or (h[:2] == b'\xff\xd8' and (b'JFIF' in h[:32] or b'8BIM' in h[:32])): return 'jpeg' --

[issue16512] imghdr doesn't support jpegs with an ICC profile

2014-06-12 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

[issue16512] imghdr doesn't support jpegs with an ICC profile

2014-06-12 Thread Claudiu.Popa
Claudiu.Popa added the comment: Using \xff\xd8 sounds good to me. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue16512] imghdr doesn't support jpegs with an ICC profile

2014-06-12 Thread Claudiu.Popa
Changes by Claudiu.Popa : -- versions: +Python 3.5 -Python 3.4 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue16512] imghdr doesn't support jpegs with an ICC profile

2014-06-12 Thread Claudiu.Popa
Changes by Claudiu.Popa : -- nosy: +Claudiu.Popa ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue16512] imghdr doesn't support jpegs with an ICC profile

2013-09-18 Thread intgr
intgr added the comment: I vote we forget about JFIF/Exif headers and only use \xff\xd8 to identify the file. They are optional and there are tons of files out in the wild without such headers, for example: https://coverartarchive.org/release/5044b557-a9ed-4a74-b763-e20580ced85d/3354872309.jpg

[issue16512] imghdr doesn't support jpegs with an ICC profile

2013-03-19 Thread Kovid Goyal
Kovid Goyal added the comment: The attached patch is insufficient, for example, it fails on http://nationalpostnews.files.wordpress.com/2013/03/budget.jpeg?w=300&h=1571 Note that the linux file utility identifies a files as "JPEG Image data" if the first two bytes of the file are \xff\xd8. A

[issue16512] imghdr doesn't support jpegs with an ICC profile

2012-11-23 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- nosy: +jcea ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue16512] imghdr doesn't support jpegs with an ICC profile

2012-11-21 Thread Joril
Joril added the comment: It looks like the test just walks a directory recursively while trying to identify its files, there's no "classic" test of the "this is a JPEG, is it detected correctly"-type -- ___ Python tracker

[issue16512] imghdr doesn't support jpegs with an ICC profile

2012-11-20 Thread Ezio Melotti
Ezio Melotti added the comment: Thanks for the patch. > should I write one for 2.7 too? Not necessary, 2.7 only gets bugs fixes. OTOH it would be nice to have some tests for this new features (and for the module in general), but there doesn't seem to be any Lib/test/test_imghdr.py file. The

[issue16512] imghdr doesn't support jpegs with an ICC profile

2012-11-20 Thread Joril
Joril added the comment: Here it is... It is against the latest hg version, should I write one for 2.7 too? -- keywords: +patch Added file: http://bugs.python.org/file28054/imghdr_icc_jpeg.patch ___ Python tracker

[issue16512] imghdr doesn't support jpegs with an ICC profile

2012-11-20 Thread Joril
Joril added the comment: I can try, yes. I'll add one ASAP -- versions: +Python 2.7 -Python 3.4 ___ Python tracker ___ ___ Python-bugs

[issue16512] imghdr doesn't support jpegs with an ICC profile

2012-11-20 Thread Ezio Melotti
Ezio Melotti added the comment: Can you provide a patch? -- nosy: +ezio.melotti stage: -> needs patch versions: +Python 3.4 -Python 2.7 ___ Python tracker ___ __

[issue16512] imghdr doesn't support jpegs with an ICC profile

2012-11-20 Thread Joril
New submission from Joril: imghdr doesn't support jpegs that include an ICC Profile. This is because imghdr looks for "JFIF" somewhere at the beginning of the file, but the ICC_PROFILE shifts that further. (The ICC spec is here http://www.color.org/specification/ICC1v43_2010-12.pdf, annex B) -