# 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')

  Alias structure equivalent to `RawData`.

## Bool

class psd_tools.psd.descriptor.Bool(value=False)

  Bool structure.

  value

    bool value

## Class

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

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

  Class structure equivalent to `Class`.

## Class2

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

  Class structure equivalent to `Class`.

## Class3

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

  Class structure equivalent to `Class`.

## Descriptor

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

  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)

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

  Enum structure.

  typeID

    bytes in `Type`

  enum

    bytes in `Enum`

  get_name() → str

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

  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: bytes = b'null')

  Global object structure equivalent to `Descriptor`.

## Identifier

class psd_tools.psd.descriptor.Identifier(value=0)

  Identifier equivalent to `Integer`.

## Index

class psd_tools.psd.descriptor.Index(value=0)

  Index equivalent to `Integer`.

## Integer

class psd_tools.psd.descriptor.Integer(value=0)

  Integer structure.

  value

    int value

## LargeInteger

class psd_tools.psd.descriptor.LargeInteger(value=0)

  LargeInteger structure.

  value

    int value

## List

class psd_tools.psd.descriptor.List(items=NOTHING)

  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 = '')

  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: bytes = b'null')

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

  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: int = 0)

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

  Undocumented path structure equivalent to `RawData`.

## RawData

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

  RawData structure.

  value

    bytes value

## Reference

class psd_tools.psd.descriptor.Reference(items=NOTHING)

  Reference structure equivalent to `List`.

## String

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

  String structure.

  value

    str value

## UnitFloat

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

  Unit float structure.

  unit

    unit of the value in `Unit` or `Enum`

  value

    float value

## UnitFloats

class psd_tools.psd.descriptor.UnitFloats(unit: Unit = Unit._None, values: list = NOTHING)

  Unit floats structure.

  unit

    unit of the value in `Unit` or `Enum`

  values

    List of float values