affinity — Load Affinity Designer Files


This module WILL change! Continue at your own risk!

class AffinityFile(file_path)

Loads and parses an Affinity Designer File


The file header info


a list containing the layers in the document


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

  • 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

  • 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