psd_sdk library

Classes

AlphaChannel
A struct representing an alpha channel as stored in the image resources section. [...]
AlphaChannelMode
Channel
A struct representing a channel as stored in the layers of the Layer Mask section.
ChannelType
A channel holding constants to distinguish between the types of data a channel can hold.
ColorMode
A class holding all color modes known by Photoshop.
CompressionType
A class holding compression types known by Photoshop.
Document
A struct storing the document-wide information and sections contained in a .PSD file.
ExportChannel
A namespace denoting a channel that is exported to the Layer Mask section.
ExportColorMode
A namespace denoting a color mode used for exporting a PSD document. Enumerator values denote the number of channels in the document as well as the PSD mode identifier.
ExportDocument
A struct representing a document to be exported.
File
Base class for all files.
Layer
A struct representing a layer as stored in the Layer Mask Info section.
LayerMask
A struct representing a layer mask as stored in the layers of the Layer Mask section.
LayerMaskSection
A struct representing the information extracted from the Layer Mask section.
LayerRect
Mask
VectorMask
A struct representing a vector mask as stored in the layers of the Layer Mask section.

Functions

addAlphaChannel(ExportDocument document, String name, int r, int g, int b, int a, int opacity, int mode) int
Adds an alpha channel to a document. The returned index can be used to update channel data by a call to updateChannel.
addLayer(ExportDocument document, String name) int
Adds a layer to a document. The returned index can be used to update layer data by a call to updateLayer.
addMetaData(ExportDocument document, String name, String value) int
Adds meta data to a document. The contents of name and value are copied. The returned index can be used to update existing meta data by a call to UpdateMetaData.
blendModeKeyToEnum(int key) BlendMode
Converts a given key to the corresponding BlendMode.
copyLayerData(Uint8List layerData, Uint8List canvasData, int bitsPerChannel, int layerLeft, int layerTop, int layerRight, int layerBottom, int canvasWidth, int canvasHeight) bool
Copies planar layer data to a canvas. Only the parts overlapping the canvas will be copied to it.
createDocument(File file) Document
Parses only the header and section offsets, and returns a newly created document.
createExportDocument(int canvasWidth, int canvasHeight, int bitsPerChannel, int colorMode) ExportDocument
Creates a new document suited for exporting a PSD file.
extractLayer(Document document, File file, Layer layer) → void
Extracts data for a given layer. It is valid and suggested to extract the data of individual layers from multiple threads in parallel.
getLastError() String
interleaveRGB(Uint8List srcR, Uint8List srcG, Uint8List srcB, num alpha, int bitsPerChannel, int width, int height, [int blockSize = 4]) Uint8List
Turns planar 8-bit RGB data into interleaved RGBA data with a constant, predefined alpha. The destination buffer dest must hold "widthheight4" bytes. All given buffers (both source and destination) must be aligned to 16 bytes.
interleaveRGBA(Uint8List srcR, Uint8List srcG, Uint8List srcB, Uint8List srcA, int bitsPerChannel, int width, int height, [int blockSize = 4]) Uint8List
Turns planar 8-bit RGBA data into interleaved RGBA data. The destination buffer dest must hold "widthheight4" bytes. All given buffers (both source and destination) must be aligned to 16 bytes.
parseImageDataSection(Document document, File file) → ImageDataSection
Parses the image data section in the document, and returns a newly created instance. It is valid to parse different sections of a document (e.g. using parseImageResourcesSection, parseImageDataSection, or parseLayerMaskSection) in parallel from different threads.
parseImageResourcesSection(Document document, File file) → ImageResourcesSection
Parses the image resources section in the document, and returns a newly created instance. It is valid to parse different sections of a document (e.g. using parseImageResourcesSection, parseImageDataSection, or parseLayerMaskSection) in parallel from different threads.
parseLayerMaskSection(Document document, File file) LayerMaskSection
Parses the layer mask section in the document, and returns a newly created instance. This function does not extract layer data yet, that has to be done by a call to ExtractLayer for each layer. It is valid to parse different sections of a document (e.g. using parseImageResourcesSection, parseImageDataSection, or parseLayerMaskSection) in parallel from different threads.
updateChannel(ExportDocument document, int channelIndex, TypedData data) → void
Updates a layer with planar 32-bit data. The function internally takes ownership over all data, so planar image data passed to this function can be freed afterwards. Planar data must hold "widthheight4" bytes, where width = right - left and height = botttom - top. Note that individual layers can be smaller and/or larger than the canvas in PSD documents.
updateLayer<T extends TypedData>(ExportDocument document, int layerIndex, int channel, int left, int top, int right, int bottom, TypedData planarData, int compression) → void
Updates a layer with planar data. The function internally takes ownership over all data, so planar image data passed to this function can be freed afterwards. Planar data must hold "width*height" bytes, where width = right - left and height = botttom - top. Note that individual layers can be smaller and/or larger than the canvas in PSD documents.
updateMergedImage(ExportDocument document, TypedData planarDataR, TypedData planarDataG, TypedData planarDataB) → void
Updates the merged image data. Planar data must hold width*height bytes.
writeDocument(ExportDocument document, File file) → void
Exports a document to the given file.

Enums

BlendMode