psd_tools.psd.descriptor

Descriptor data structure.

Descriptors are basic data structure used throughout PSD files.

Alias

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

Alias structure equivalent to RawData.

value
ostype = b'alis'

Bool

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

Bool structure.

value
ostype = b'bool'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

Class

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

Class structure.

name
classID
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

Class1

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

Class structure equivalent to Class.

ostype = b'type'

Class2

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

Class structure equivalent to Class.

ostype = b'GlbC'

Class3

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

Class structure equivalent to Class.

ostype = b'Clss'

Descriptor

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

Dict-like descriptor structure.

Example:

for key in descriptor:
    print(descriptor[key])
name
classID
ostype = b'Objc'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

Double

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

Double structure.

value
ostype = b'doub'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

Enum

class psd_tools.psd.descriptor.Enum(typeID: bytes = b'x00x00x00x00', enum: bytes = b'x00x00x00x00')[source]

Enum structure.

value
ostype = b'enum'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

EnumeratedReference

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

Enumerated reference structure.

value
ostype = b'Enmr'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

GlobalObject

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

Global object structure equivalent to Descriptor.

ostype = b'GlbO'

Identifier

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

Identifier equivalent to Integer.

ostype = b'Idnt'

Index

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

Index equivalent to Integer.

ostype = b'indx'

Integer

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

Integer structure.

value
ostype = b'long'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

LargeInteger

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

LargeInteger structure.

value
ostype = b'comp'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

List

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

List structure.

items
ostype = b'VlLs'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

Name

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

Name structure (Undocumented).

ostype = b'name'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

ObjectArray

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

Object array structure almost equivalent to Descriptor.

items_count
name
classID
ostype = b'ObAr'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

Property

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

Property structure.

name
ostype = b'prop'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

Offset

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

Offset structure.

value
ostype = b'rele'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

Path

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

Undocumented path structure equivalent to RawData.

ostype = b'Pth '

RawData

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

RawData structure.

value

bytes

ostype = b'tdta'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

Reference

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

Reference structure equivalent to List.

ostype = b'obj '

String

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

String structure.

value
ostype = b'TEXT'

UnitFloat

class psd_tools.psd.descriptor.UnitFloat(value: float = 0.0, unit=<UnitFloatType.NONE: b'#Nne'>)[source]

Unit float structure.

unit
value
ostype = b'UntF'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
unit
value
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object

UnitFloats

class psd_tools.psd.descriptor.UnitFloats(unit=<UnitFloatType.NONE: b'#Nne'>, values=NOTHING)[source]

Unit floats structure.

unit
values
ostype = b'UnFl'
classmethod read(fp)[source]

Read the element from a file-like object.

Parameters:fp – file-like object
write(fp)[source]

Write the element to a file-like object.

Parameters:fp – file-like object