mirror of https://github.com/python/cpython
Issue #20197: Added support for the WebP image type in the imghdr module.
Patch by Fabrice Aneche and Claudiu Popa.
This commit is contained in:
parent
e84d26c61b
commit
2f8dca735e
|
@ -48,6 +48,11 @@ from :func:`what`:
|
||||||
+------------+-----------------------------------+
|
+------------+-----------------------------------+
|
||||||
| ``'png'`` | Portable Network Graphics |
|
| ``'png'`` | Portable Network Graphics |
|
||||||
+------------+-----------------------------------+
|
+------------+-----------------------------------+
|
||||||
|
| ``'webp'`` | WebP files |
|
||||||
|
+------------+-----------------------------------+
|
||||||
|
|
||||||
|
.. versionchanged:: 3.5
|
||||||
|
The *webp* type was added.
|
||||||
|
|
||||||
You can extend the list of file types :mod:`imghdr` can recognize by appending
|
You can extend the list of file types :mod:`imghdr` can recognize by appending
|
||||||
to this variable:
|
to this variable:
|
||||||
|
|
|
@ -110,6 +110,12 @@ def test_bmp(h, f):
|
||||||
|
|
||||||
tests.append(test_bmp)
|
tests.append(test_bmp)
|
||||||
|
|
||||||
|
def test_webp(h, f):
|
||||||
|
if h.startswith(b'RIFF') and h[8:12] == b'WEBP':
|
||||||
|
return 'webp'
|
||||||
|
|
||||||
|
tests.append(test_webp)
|
||||||
|
|
||||||
#--------------------#
|
#--------------------#
|
||||||
# Small test program #
|
# Small test program #
|
||||||
#--------------------#
|
#--------------------#
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 432 B |
|
@ -16,7 +16,8 @@ TEST_FILES = (
|
||||||
('python.ras', 'rast'),
|
('python.ras', 'rast'),
|
||||||
('python.sgi', 'rgb'),
|
('python.sgi', 'rgb'),
|
||||||
('python.tiff', 'tiff'),
|
('python.tiff', 'tiff'),
|
||||||
('python.xbm', 'xbm')
|
('python.xbm', 'xbm'),
|
||||||
|
('python.webp', 'webp'),
|
||||||
)
|
)
|
||||||
|
|
||||||
class UnseekableIO(io.FileIO):
|
class UnseekableIO(io.FileIO):
|
||||||
|
|
|
@ -42,6 +42,7 @@ Pehr Anderson
|
||||||
Erik Andersén
|
Erik Andersén
|
||||||
Oliver Andrich
|
Oliver Andrich
|
||||||
Ross Andrus
|
Ross Andrus
|
||||||
|
Fabrice Aneche
|
||||||
Juancarlo Añez
|
Juancarlo Añez
|
||||||
Chris Angelico
|
Chris Angelico
|
||||||
Jérémy Anger
|
Jérémy Anger
|
||||||
|
|
|
@ -89,6 +89,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #20197: Added support for the WebP image type in the imghdr module.
|
||||||
|
Patch by Fabrice Aneche and Claudiu Popa.
|
||||||
|
|
||||||
- Issue #21513: Speedup some properties of IP addresses (IPv4Address,
|
- Issue #21513: Speedup some properties of IP addresses (IPv4Address,
|
||||||
IPv6Address) such as .is_private or .is_multicast.
|
IPv6Address) such as .is_private or .is_multicast.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue