psd_tools.psd.base

Base data structures intended for inheritance.

All the data objects in this subpackage inherit from the base classes here. That means, all the data structures in the psd_tools.psd subpackage implements the methods of BaseElement for serialization and decoding.

Objects that inherit from the BaseElement typically gets attrs decoration to have data fields.

BaseElement

class psd_tools.psd.base.BaseElement[source]

Base element of various PSD file structs. All the data objects in psd_tools.psd subpackage inherit from this class.

classmethod read(cls, fp)[source]

Read the element from a file-like object.

write(self, fp)[source]

Write the element to a file-like object.

classmethod frombytes(self, data, *args, **kwargs)[source]

Read the element from bytes.

tobytes(self, *args, **kwargs)[source]

Write the element to bytes.

validate(self)[source]

Validate the attribute.

EmptyElement

class psd_tools.psd.base.EmptyElement[source]

Empty element that does not have a value.

ValueElement

class psd_tools.psd.base.ValueElement(value=None)[source]

Single value wrapper that has a value attribute.

Pretty printing shows the internal value by default. Inherit with @attr.s(repr=False) decorator to keep this behavior.

value

Internal value.

NumericElement

class psd_tools.psd.base.NumericElement(value=0.0)[source]

Single value element that has a numeric value attribute.

IntegerElement

class psd_tools.psd.base.IntegerElement(value=0)[source]

Single integer value element that has a value attribute.

Use with @attr.s(repr=False) decorator.

ShortIntegerElement

class psd_tools.psd.base.ShortIntegerElement(value=0)[source]

Single short integer element that has a value attribute.

Use with @attr.s(repr=False) decorator.

ByteElement

class psd_tools.psd.base.ByteElement(value=0)[source]

Single 1-byte integer element that has a value attribute.

Use with @attr.s(repr=False) decorator.

BooleanElement

class psd_tools.psd.base.BooleanElement(value=False)[source]

Single bool value element that has a value attribute.

Use with @attr.s(repr=False) decorator.

StringElement

class psd_tools.psd.base.StringElement(value: str = '')[source]

Single unicode string.

value

str value

ListElement

class psd_tools.psd.base.ListElement(items=_Nothing.NOTHING)[source]

List-like element that has items list.

DictElement

class psd_tools.psd.base.DictElement(items=_Nothing.NOTHING)[source]

Dict-like element that has items OrderedDict.