Detect a file's real format from its magic bytes (not its extension) and get a human-readable summary of what's inside it.
Supports PNG, JPEG, BMP, WAV, MP3, ZIP, TAR, GZIP, PDF, PE (EXE/DLL), ELF, and MP4. Pure standard library, no dependencies.
pip install humanishfrom humanish import humanish, detect_format
detect_format("mystery.bin") # -> "png"
humanish("photo.jpg")
# {
# "format": "jpeg",
# "width": 1920,
# "height": 1080,
# "components": 3,
# ...
# }Detect from bytes you already have in memory:
from humanish import detect_format_from_bytes
detect_format_from_bytes(open("mystery.bin", "rb").read(64))humanish path/to/filePrints the format and content summary as JSON.
MIT