affinity — Load Affinity Designer Files

Danger

This module WILL change! Continue at your own risk!

class AffinityFile(file_path)

Loads and parses an Affinity Designer File

header

The file header info

layers

a list containing the layers in the document

documents

A dictionary containing all documents in the file

class FATHeader(flags, date, unused, offsets, length, unused_2)

Parses a FAT header from the root AFD document

Parameters:
  • flags (int) – the flags to the header has
  • date (datetime.datetime) – the date the file was created
  • unused – IDK yet
  • offsets (tuple<int>) – Some offsets?
  • length (int) – length of the FAT section
  • unused_2 – Yet more unused data
static create_from_file(f)

reads the data from a binary file-object and returns a new FATHeader

class FATEntry(idk, offset, real_len, c_len, date, compressed, fname_len, filename, data)

Stores a FAT Entry

Parameters:
  • idk – I do not know what this is yet
  • offset (int) – Offset to the data
  • real_len (int) – Length of the uncompressed data
  • c_len (int) – Length of the compressed data
  • date (datetime.datetime) – The timestamp of the entry
  • compressed (bool) – Whether or not the data is compressed
  • fname_len (int) – The length of the filename
  • filename (str) – The filename
  • data (bytes) – the entries file contents
static create_from_file(f)

parses a FATEntry from the file-object in f

Parameters:f (file) – The file-object to use to crate the FATEntry