添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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.

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

Class structure.

name

str value

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

Class structure equivalent to Class.

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

Class structure equivalent to Class.

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

Class structure equivalent to Class.

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])
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

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

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

Global object structure equivalent to Descriptor.

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

Identifier equivalent to Integer.

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

LargeInteger structure.

value

int value

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

List structure.

Example:

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

Name structure (Undocumented).

name 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

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

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

Offset structure.

name

str value

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

Undocumented path structure equivalent to RawData.

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

RawData structure.

value

bytes value

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

Reference structure equivalent to List.

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

String structure.

value

str value

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

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

Unit floats structure.

unit

unit of the value in Unit or Enum