png_read_meta
- lib.image.png_read_meta(image: bytes) PNGHeader | dict[str, Any]
Read the Faceswap information stored in a png’s iTXt field.
- Parameters:
image (bytes) – The bytes encoded png file to read header data from
- Returns:
The Faceswap information stored in the PNG header. This will either be a PNGHeader object if an
extracted face, or other arbitrary information (for example for the Patch Writer)
- Return type:
PNGHeader | dict[str, Any]
Notes
This is a very stripped down, non-robust and non-secure header reader to fit a very specific task. OpenCV will not write any iTXt headers to the PNG file, so we make the assumption that the only iTXt header that exists is the one that Faceswap created for storing alignments.