psd_tools.psd.descriptor

Descriptor data structure.

Descriptors are basic data structure used throughout PSD files. Descriptor is one kind of serialization protocol for data objects, and enum classes in psd_tools.terminology or bytes indicates what kind of descriptor it is.

The class ID can be pre-defined enum if the tag is 4-byte length or plain bytes if the length is arbitrary. They depend on the internal version of Adobe Photoshop but the detail is unknown.

Pretty printing is the best approach to check the descriptor content:

from IPython.pretty import pprint
pprint(descriptor)

Alias

class psd_tools.psd.descriptor.Alias(value: bytes = b'\x00\x00\x00\x00')[source]

Alias structure equivalent to RawData.

Bool

class psd_tools.psd.descriptor.Bool(value=False)[source]

Bool structure.

value

bool value

Class

class psd_tools.psd.descriptor.Class(name: str = '', classID: bytes = b'\x00\x00\x00\x00')[source]

Class structure.

name

str value

classID

bytes in Klass

Class1

class psd_tools.psd.descriptor.Class1(name: str = '', classID: bytes = b'\x00\x00\x00\x00')[source]

Class structure equivalent to Class.

Class2

class psd_tools.psd.descriptor.Class2(name: str = '', classID: bytes = b'\x00\x00\x00\x00')[source]

Class structure equivalent to Class.

Class3

class psd_tools.psd.descriptor.Class3(name: str = '', classID: bytes = b'\x00\x00\x00\x00')[source]

Class structure equivalent to Class.

Descriptor

class psd_tools.psd.descriptor.Descriptor(items=NOTHING, name: str = '', classID=b'null')[source]

Dict-like descriptor structure.

Key values can be 4-character bytes in Key or arbitrary length bytes. Supports direct access by Key.

Example:

from psd_tools.terminology import Key

descriptor[Key.Enabled]

for key in descriptor:
    print(descriptor[key])
name

str

classID

bytes in Klass

Double

class psd_tools.psd.descriptor.Double(value=0.0)[source]

Double structure.

value

float value

Enumerated

class psd_tools.psd.descriptor.Enumerated(typeID: bytes = b'\x00\x00\x00\x00', enum: bytes = b'\x00\x00\x00\x00')[source]

Enum structure.

typeID

bytes in Type

enum

bytes in Enum

get_name()[source]

Get enum name.

EnumeratedReference

class psd_tools.psd.descriptor.EnumeratedReference(name: str = '', classID: bytes = b'\x00\x00\x00\x00', typeID: bytes = b'\x00\x00\x00\x00', enum: bytes = b'\x00\x00\x00\x00')[source]

Enumerated reference structure.

name

str value

classID

bytes in Klass

typeID

bytes in Type

enum

bytes in Enum

GlobalObject

class psd_tools.psd.descriptor.GlobalObject(items=NOTHING, name: str = '', classID=b'null')[source]

Global object structure equivalent to Descriptor.

Identifier

class psd_tools.psd.descriptor.Identifier(value=0)[source]

Identifier equivalent to Integer.

Index

class psd_tools.psd.descriptor.Index(value=0)[source]

Index equivalent to Integer.

Integer

class psd_tools.psd.descriptor.Integer(value=0)[source]

Integer structure.

value

int value

LargeInteger

class psd_tools.psd.descriptor.LargeInteger(value=0)[source]

LargeInteger structure.

value

int value

List

class psd_tools.psd.descriptor.List(items=NOTHING)[source]

List structure.

Example:

for item in list_value:
    print(item)

Name

class psd_tools.psd.descriptor.Name(name: str = '', classID: bytes = b'\x00\x00\x00\x00', value: str = '')[source]

Name structure (Undocumented).

name

str

classID

bytes in Klass

value

str

ObjectArray

class psd_tools.psd.descriptor.ObjectArray(items=NOTHING, items_count: int = 0, name: str = '', classID=b'null')[source]

Object array structure almost equivalent to Descriptor.

items_count

int value

name

str value

classID

bytes in Klass

Property

class psd_tools.psd.descriptor.Property(name: str = '', classID: bytes = b'\x00\x00\x00\x00', keyID: bytes = b'\x00\x00\x00\x00')[source]

Property structure.

name

str value

classID

bytes in Klass

keyID

bytes in Key

Offset

class psd_tools.psd.descriptor.Offset(name: str = '', classID: bytes = b'\x00\x00\x00\x00', value=0)[source]

Offset structure.

name

str value

classID

bytes in Klass

value

int value

Path

class psd_tools.psd.descriptor.Path(value: bytes = b'\x00\x00\x00\x00')[source]

Undocumented path structure equivalent to RawData.

RawData

class psd_tools.psd.descriptor.RawData(value: bytes = b'\x00\x00\x00\x00')[source]

RawData structure.

value

bytes value

Reference

class psd_tools.psd.descriptor.Reference(items=NOTHING)[source]

Reference structure equivalent to List.

String

class psd_tools.psd.descriptor.String(value: str = '')[source]

String structure.

value

str value

UnitFloat

class psd_tools.psd.descriptor.UnitFloat(value: float = 0.0, unit=Unit._None)[source]

Unit float structure.

unit

unit of the value in Unit or Enum

value

float value

UnitFloats

class psd_tools.psd.descriptor.UnitFloats(unit=Unit._None, values=NOTHING)[source]

Unit floats structure.

unit

unit of the value in Unit or Enum

values

List of float values