What the inspector checks

CheckWhat it catchesFix explained in
First bytes vs nameHTML error pages saved as .jpg, HEIC renamed to JPEG, PDFs, SVGs, ZIPscannot identify image file
Image.open()Formats Pillow cannot read or needs a plugin for (HEIC), decompression bombsconverting formats, DecompressionBombError
load()Cut-off downloads and damaged files, which open fine and fail laterimage file is truncated
Mode16-bit, 32-bit, float, CMYK, palette and alpha images that break convert(), JPEG saving or NumPy codeimage modes, cannot write mode
ICC profileDisplay P3 and Adobe RGB photos whose colours shift when the profile is droppedImageCms
EXIFPhotos stored sideways, and GPS locations you may not want to publishEXIF
SizeImages large enough to exhaust memory once convertedresizing

How the script is tested

The build runs the generated script with Pillow 13.0.0 on real and deliberately broken files: a Display P3 photo, a sideways phone photo, an iPhone HEIC, a transparent PNG, an animated GIF, a 16-bit PNG, a web page saved as .jpg, a half-downloaded JPEG, an empty file, an SVG and a PDF. Each must produce the expected diagnosis, or the build fails. In the browser it runs on Pillow's WebAssembly build (Pyodide), which can lag a release behind and is built without AVIF support and without LittleCMS; the version and features are printed at the end of the report, and the colour-profile name is read directly from the file so that check works there too.

Running it on your own computer

Copy the script, change PATH to your file and run it. It needs only Pillow; if pillow-heif is installed it also checks HEIC and HEIF files. To check a whole folder, wrap everything after PATH in a function and call it for each file, as in processing all images in a folder.