psd_tools.api.smart_object

Smart object module.

SmartObject

class psd_tools.api.smart_object.SmartObject(layer)[source]

Smart object that represents embedded or external file.

Smart objects are attached to SmartObjectLayer.

data

Embedded file content, or empty if kind is external or alias

filename

Original file name of the object.

filesize

File size of the object.

filetype

Preferred file extension, such as jpg.

is_psd()[source]

Return True if the file is embedded PSD/PSB.

kind

Kind of the link, ‘data’, ‘alias’, or ‘external’.

open(external_dir=None)[source]

Open the smart object as binary IO.

Parameters:external_dir – Path to the directory of the external file.

Example:

with layer.smart_object.open() as f:
    data = f.read()
resolution

Resolution of the object.

save(filename=None)[source]

Save the smart object to a file.

Parameters:filename – File name to export. If None, use the embedded name.
unique_id

UUID of the object.

warp

Warp parameters.