Class: PSD

Defined in: lib/psd.coffee
Inherits: Module

Overview

A general purpose parser for Photoshop files. PSDs are broken up in to 4 logical sections: the header, resources, the layer mask (including layers), and the preview image. We parse each of these sections in order.

Examples:

How to read and parse a PSD asynchronously

PSD.open('path/to/file.psd').then (psd) ->
  console.log psd.tree().export()
  

How to read and parse a PSD synchronously

psd = PSD.fromFile('path/to/file.psd')
psd.parse()
console.log psd.tree().export()

Instance Method Summary

Constructor Details

# (void) constructor(data)

Creates a new PSD object.

Parameters:

  • The ( Uint8Array ) PSD file data.

Instance Method Details

# (void) parse()

Parses the PSD. You must call this method before attempting to access PSD data. It will not re-parse the PSD if it has already been parsed.

# (void) parseHeader() Private

# (void) parseResources() Private

# (void) parseLayerMask() Private

# (void) parseImage() Private

# (Node.Root) tree()

Returns a tree representation of the PSD document, which is the preferred way of accessing most PSD data.

Returns:

  • ( Node.Root ) — The root node of the PSD.

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: