Historical and Removed Modules

imghdr

Removed from the standard library in Python 3.13; historical example targets Python 3.12. Guessed a limited set of image types from file headers. Use a maintained format-detection library or an image decoder for content validation. Filename-based mimetypes guesses are not a substitute for checking actual bytes.

Formal Syntax & Structure

python syntaxpython
import imghdr  # Historical only: removed in Python 3.13

Return Value

module (historical)

Historical module namespace, not a supported standard-library import on the Python 3.13 baseline.

Working Example

Example Snippetpython
# Historical example: Python 3.12; not executed.import imghdrprint(imghdr.what(None,h=b"\x89PNG\r\n\x1a\n"))
Python Reference