psdparser module

class psdparser.PSDLayer(aName, aLayerNo, aFormat, aWidth, aHeight, aDepth, aColorMode)

Bases: object

Class PSDLayer is used to gather information on a layer of a PSD file

Members:
  • mName (str): name of the function definition.

  • mLayerNo (str): unique identifier in the package/ context.

  • mFormat (str): various attributes

  • mWidth (int): width in pixel

  • mHeight (int): height in pixel

  • mDepth (sbsenum.OutputFormatEnum): bit depth

  • mColorMode (sbsenum.ColorModeEnum): color mode

static convertColorToSbsEnum(aColor)
static convertDepthToSbsEnum(aDepth)
getFilterParamColor()
getFilterParamSize()
psdparser.extractCompositeTo(aContext, aPsdFileAbsPath, aDestinationFolder)

Extract the composite image of the given .psd file into a .png file, and save it in the destination folder.

Parameters:
  • aContext (Context) – current execution context

  • aPsdFileAbsPath (str) – path of the .psd file

  • aDestinationFolder (str) – absolute path of the destination folder

Returns:

the output path as a string

psdparser.extractLayerTo(aContext, aPsdFileAbsPath, aLayer, aDestinationFolder)

Extract the layer image of the given .psd file into a .png file, and save it in the destination folder.

Parameters:
  • aContext (Context) – current execution context

  • aPsdFileAbsPath (str) – path of the .psd file

  • aLayer (PSDLayer) – layer to extract

  • aDestinationFolder (str) – absolute path of the destination folder

Returns:

the output path as a string

psdparser.getLayers(aContext, aPsdFileAbsPath)

Get the list of layers included in the given .psd file.

Parameters:
  • aContext (Context) – current execution context

  • aPsdFileAbsPath (str) – path of the .psd file

Returns:

a list of PSDLayer

psdparser.getPsdLayerFromList(aPsdLayerList, aLayerName)
Parameters:
  • aPsdLayerList (list of PSDLayer) – list of layer

  • aLayerName (str) – the layer to find

Returns:

the PSDLayer object if found, None otherwise

psdparser.getPsdLayerNameFromResource(aResource)
Parameters:

aResource (class:.SBSResource) – A Resource which should be based on a .psd layer

Returns:

The layer name as save in the .psd file, or None if the resource is not extracted from a .psd file