pack_to_itxt

lib.image.pack_to_itxt(metadata: PNGHeader | dict[str, Any] | bytes) bytes

Pack the given metadata dictionary to a PNG iTXt header field.

Parameters:

metadata (PNGHeader | dict[str, Any] | bytes) – The dictionary to write to the header. Can be pre-encoded as utf-8.

Return type:

A byte encoded PNG iTXt field, including chunk header and CRC