The c2pa-python repository provides a Python library that can:
- Read and validate C2PA manifest data from media files in supported formats.
- Create and sign manifest data, and attach it to media files in supported formats.
Features:
- Create and sign C2PA manifests using various signing algorithms.
- Verify C2PA manifests and extract metadata.
- Add assertions and ingredients to assets.
- Examples and unit tests to demonstrate usage.
For the best experience, read the docs on the CAI Open Source SDK documentation website.
If you want to view the documentation in GitHub, see:
- Using the Python library
- Supported formats
- Configuring the SDK using
ContextandSettings - Using Builder intents to ensure spec-compliant manifests
- Using working stores and archvies
- Selectively constructing manifests by filtering actions and ingredients
- Diagram of public classes in the Python library and their relationships
- Release notes
This library requires Python version 3.10+.
Install the c2pa-python package from PyPI by running:
pip install c2pa-pythonTo use the module in Python code, import the module like this:
import c2paSee the examples directory for some helpful examples:
examples/read.pyshows how to read and verify an asset with a C2PA manifest.examples/sign.pyshows how to sign and verify an asset with a C2PA manifest.examples/training.pydemonstrates how to add a "Do Not Train" assertion to an asset and verify it.
Documentation is published at github.io/c2pa-python/api/c2pa.
To build documentation locally, refer to this section in Contributing to the project.
Contributions are welcome! For more information, see Contributing to the project.
This project is licensed under the Apache License 2.0 and the MIT License. See the LICENSE-MIT and LICENSE-APACHE files for details.