mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
#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
6 changed files with 20 additions and 0 deletions
|
@ -50,6 +50,11 @@ from :func:`what`:
|
||||||
+------------+-----------------------------------+
|
+------------+-----------------------------------+
|
||||||
| ``'webp'`` | WebP files |
|
| ``'webp'`` | WebP files |
|
||||||
+------------+-----------------------------------+
|
+------------+-----------------------------------+
|
||||||
|
| ``'exr'`` | OpenEXR Files |
|
||||||
|
+------------+-----------------------------------+
|
||||||
|
|
||||||
|
.. versionadded:: 3.5
|
||||||
|
The *exr* format was added.
|
||||||
|
|
||||||
.. versionchanged:: 3.5
|
.. versionchanged:: 3.5
|
||||||
The *webp* type was added.
|
The *webp* type was added.
|
||||||
|
|
|
@ -141,6 +141,12 @@ doctest
|
||||||
*module* contains no docstrings instead of raising :exc:`ValueError`
|
*module* contains no docstrings instead of raising :exc:`ValueError`
|
||||||
(contributed by Glenn Jones in :issue:`15916`).
|
(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
|
importlib
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,12 @@ def test_webp(h, f):
|
||||||
|
|
||||||
tests.append(test_webp)
|
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 #
|
# 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.tiff', 'tiff'),
|
||||||
('python.xbm', 'xbm'),
|
('python.xbm', 'xbm'),
|
||||||
('python.webp', 'webp'),
|
('python.webp', 'webp'),
|
||||||
|
('python.exr', 'exr'),
|
||||||
)
|
)
|
||||||
|
|
||||||
class UnseekableIO(io.FileIO):
|
class UnseekableIO(io.FileIO):
|
||||||
|
|
|
@ -103,6 +103,8 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #20295: imghdr now recognizes OpenEXR format images.
|
||||||
|
|
||||||
- Issue #21729: Used the "with" statement in the dbm.dumb module to ensure
|
- Issue #21729: Used the "with" statement in the dbm.dumb module to ensure
|
||||||
files closing. Patch by Claudiu Popa.
|
files closing. Patch by Claudiu Popa.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue