mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
#20295: Teach imghdr to recognize OpenEXR format images.
Patch by Martin Vignali, test by Claudiu Popa.
This commit is contained in:
@@ -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 #
|
||||
#--------------------#
|
||||
|
||||
BIN
Lib/test/imghdrdata/python.exr
Normal file
BIN
Lib/test/imghdrdata/python.exr
Normal file
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):
|
||||
|
||||
Reference in New Issue
Block a user