Getting started with Python
Requirements
Python 3.10 or later.
Install a package
Install the package of each format family that you use. The examples on this page use the image family.
Detect the format of a file
Give the bytes of a file to detect. The function needs only the first bytes of
the file. 64 bytes are enough for most image files.
When the format is not recognized, detect returns None.
List the supported formats
supported_formats returns the identifier of each format that detect can
return.
Compare two images
compare_images decodes two PNG files, compares them with the algorithm of
pixelmatch, and encodes the diff image.
Next steps
- Read the API reference of each format family.
- If you use pixelmatch-py, read Migrate from pixelmatch-py.
- If you calculate SSIM with scikit-image, read Migrate SSIM from scikit-image.
- Read Development to build anyformat from source.