Class: jPsdDocument

jPsdDocument

Provide many informations of psd document.

new jPsdDocument()

psd document. For detail information, see http://www.adobe.com/devnet-apps/photoshop/fileformatashtml.
Source:

Members

(static, readonly) Compression :Number

Enum for compression
Type:
  • Number
Properties:
Name Type Description
RAW Number
RLE Number
ZIP Number
ZIPPRED Number
Source:

(static, readonly) LayerType :Number

Enum for jLayer type
Type:
  • Number
Properties:
Name Type Description
Normal Number
AnyOther Number
OpenFolder Number
ClosedFolder Number
BoundingSection Number
Source:

(static, readonly) ResourceID :Number

Enum for resource id.
Type:
  • Number
Properties:
Name Type Description
Unknown Number
BasicInfo Number
PrintInfoRecordOfMacintosh Number
IndexedColorTable Number
ResolutionInfo Number
NameOfAlphaChannels Number
DisplayInfo Number
Caption Number
BorderInfo Number
BackgroundColor Number
PrintFlag Number
GrayscaleInfo Number
ColorHalftonInfo Number
DuotoneHalftonInfo Number
GraysacleTransferInfo Number
ColorTransferFunctions Number
DuotoneTransferFunctions Number
DuotoneImageInfo Number
DotRange Number
Obsolete1 Number
EPSOptions Number
QuickMaskInfo Number
Obsolete2 Number
LayerStateInfo Number
WorkingPath Number
LayersGroupInfo Number
Obsolete3 Number
IPTC_NAA_Record Number
ImageModeForRawFormatFile Number
JPEG_Quality Number
GridGuidesInfo Number
ThumbnailResource4 Number
CopyrightFlag Number
URL Number
ThumbnailResource5 Number
GlobalAngle Number
ColorSamplers Number
ICCProfile Number
WaterMark Number
ICCUntaggedProfile Number
EffectsVisible Number
SpotHalftone Number
IDSeedNumber Number
UnicodeAlphaName Number
IndexedColorTableCount Number
TransparencyIndex Number
GlobalAltitude Number
Slices Number
WorkflowURL Number
JumpToXPEP Number
AlphaID Number
URLList Number
VersionInfo Number
EXIF1 Number
EXIF2 Number
XMP Number
CaptionDigest Number
PrintScale Number
PixelAspectRatio Number
LayerComps Number
AlternateDuotoneColors Number
AlternateSpotColors Number
LayerSelectionID Number
HDRToningInfo Number
PrintInfoOnCS2 Number
LayerGroupEnabledID Number
ColorSamplersResource Number
MeasurementScale Number
TimelineInfo Number
SheetDisclosure Number
DisplayInfoStructure Number
OnionSkins Number
CountInfo Number
PrintInfoOnCS5 Number
PrintStyle Number
MacintoshNSPrintInfo Number
WindowsDevMode Number
AutoSaveFilePath Number
AutoSaveFormat Number
ClipPathName Number
ImageReadyVariables Number
ImageReadyDataSets Number
LightroomWorkflow Number
PrintFlagsInfo Number
Source:

(readonly) channelCount :Number

The number of channels in the image, including any alpha channels.
Type:
  • Number
Source:

(readonly) colorMode :Number

The color mode of the file. Bitmap = 0, Grayscale = 1, Indexed = 2, RGB = 3, CMYK = 4, Multichannel = 7, Duotone = 8, Lab = 9.
Type:
  • Number
Source:

(readonly) depth :Number

The number of bits per channel.
Type:
  • Number
Source:

(readonly) globalMask

Global layer mask information of the file. This value contains length, overlayColorSpace, colorComponents, opacity, kind and filter. length : length of global layer mask info section overlayColorSpace : undocumented colorComponents : 4 * 2 byte color components opacity : 0 = transparent, 100 = opaque. kind: 0 = Color selected--i.e. inverted; 1 = Color protected;128 = use value stored per layer. This value is preferred. The others are for backward compatibility with beta versions. For more information, see http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_17115
Source:

(readonly) height :Number

The height of the image in pixels.
Type:
  • Number
Source:

(readonly) imageData

Global layer mask information of the file. This value contains compression and data. compression : 0 = Raw image data 1 = RLE compressed the image data starts with the byte counts for all the scan lines (rows * channels), with each count stored as a two-byte value. The RLE compressed data follows, with each scan line compressed separately. The RLE compression is the same compression algorithm used by the Macintosh ROM routine PackBits , and the TIFF standard. 2 = ZIP without prediction 3 = ZIP with prediction. data : The image data. Planar order = RRR GGG BBB, etc. For more information, see http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_89817
Source:

(readonly) imageResources :Array

Image Resource Block list of the file. Each element has id, name and data. For more information, see http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_46269
Type:
  • Array
Source:

(readonly) layerCount :Number

Number of the layer.
Type:
  • Number
Source:

(readonly) transparencyDataMerged :Boolean

If this value is true, document contains alpha channel. If this value is false, document doesn't contains alpha channel.
Type:
  • Boolean
Source:

(readonly) version :Number

Always equal to 1.
Type:
  • Number
Source:

(readonly) width :Number

The width of the image in pixels.
Type:
  • Number
Source:

Methods

dispose()

Release all resource.
Source:

getAdditionalInfoDic()

Additional information of the file. For more information, see http://www.adobe.com/devnet-apps/photoshop/fileformatashtml
Source:

getAllLayers()

Get all layers of the document.
Source:
Returns:
Array - jLayer array.

getImage()

Get image of the file. Return value is encoded by base64. Need to append prefix 'data:image/png;base64,' to display image on web browser.
Source:
Returns:
String - Image data that is encoded by base64.
Example
<head>
    <script src="./jPsdReader.js" type="text/javascript"></script>
    <script>
        function loadImage() {
           var psdFile = document.getElementById("file").files[0];
           jPsdReader.load({
                file: psdFile,
                success: function(psd) {
                    document.getElementById("img").src = "data:image/png;base64," + psd.getImage();
                    psd.dispose();
                },
                error: function(e) {
                   alert(e.message);
                }
           });
        }
    </script>
</head>
<body>
    <input id="file" type="file"/>
    <img id="img"/>
    <input type="button" onclick="loadImage()" value="load"/> 
</body>

getLayers()

Get all direct child layers of the document. For get all layer of the document, use the jPsdDocument.getAllLayers
Source:
Returns:
Array - jLayer array.

getResolution() → {Number}

Get resolution of the file.
Source:
Returns:
Type
Number