#20295: Teach imghdr to recognize OpenEXR format images.
Patch by Martin Vignali, test by Claudiu Popa.
This commit is contained in:
parent
a157867a3d
commit
2f60820f4c
|
@ -50,6 +50,11 @@ from :func:`what`:
|
|||
+------------+-----------------------------------+
|
||||
| ``'webp'`` | WebP files |
|
||||
+------------+-----------------------------------+
|
||||
| ``'exr'`` | OpenEXR Files |
|
||||
+------------+-----------------------------------+
|
||||
|
||||
.. versionadded:: 3.5
|
||||
The *exr* format was added.
|
||||
|
||||
.. versionchanged:: 3.5
|
||||
The *webp* type was added.
|
||||
|
|
|
@ -141,6 +141,12 @@ doctest
|
|||
*module* contains no docstrings instead of raising :exc:`ValueError`
|
||||
(contributed by Glenn Jones in :issue:`15916`).
|
||||
|
||||
imghdr
|
||||
------
|
||||
|
||||
* :func:`~imghdr.what` now recognizes the `OpenEXR <http://www.openexr.com>`_
|
||||
format (contributed by Martin vignali and Cladui Popa in :issue:`20295`).
|
||||
|
||||
importlib
|
||||
---------
|
||||
|
||||
|
|
|
@ -116,6 +116,12 @@ def test_webp(h, f):
|
|||
|
||||
tests.append(test_webp)
|
||||
|
||||
def test_exr(h, f):
|
||||
if h.startswith(b'\x76\x2f\x31\x01'):
|
||||
return 'exr'
|
||||
|
||||
tests.append(test_exr)
|
||||
|
||||
#--------------------#
|
||||
# Small test program #
|
||||
#--------------------#
|
||||
|
|
Binary file not shown.
|
@ -18,6 +18,7 @@ TEST_FILES = (
|
|||
('python.tiff', 'tiff'),
|
||||
('python.xbm', 'xbm'),
|
||||
('python.webp', 'webp'),
|
||||
('python.exr', 'exr'),
|
||||
)
|
||||
|
||||
class UnseekableIO(io.FileIO):
|
||||
|
|
Loading…
Reference in New Issue