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.

property data

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

property filename

Original file name of the object.

property filesize

File size of the object.

property filetype

Preferred file extension, such as jpg.

is_psd()[source]

Return True if the file is embedded PSD/PSB.

property 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()
property 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.

property unique_id

UUID of the object.

property warp

Warp parameters.