new jLayer()
Layer
- Source:
Members
-
(static, readonly) Compression :Number
-
Enum for compression
Type:
- Number
Properties:
Name Type Description RAW
Number RLE
Number ZIP
Number ZIPPRED
Number - Source:
-
(readonly) additionalInfoDic :Array
-
Additional layer information For more information, see http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_pgfId-1049436 This type is key-value dictionary.
Type:
- Array
- Source:
-
(readonly) blendModeKey :String
-
Blend mode key For more information, see http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_13084
Type:
- String
- Source:
-
(readonly) bottom :Int32
-
Location of layer. bottom
Type:
- Int32
- Source:
-
(readonly) channelRanges :Array
-
Ranges of channel This type is array of jChannelRange
Type:
- Array
- Source:
-
(readonly) channels :Array
-
Channels of this layer. This type is array of jChannel
Type:
- Array
- Source:
-
(readonly) childLayers :Array
-
All direct child layers. This type is array of
jLayer
Type:
- Array
- Source:
-
(readonly) clipping :Byte
-
Clipping 0 = base, 1 = non-base
Type:
- Byte
- Source:
-
(readonly) filter :Byte
-
Allways this value is zero.
Type:
- Byte
- Source:
-
(readonly) flags :Byte
-
Flags of layer bit 0 = transparency protected; bit 1 = visible; bit 2 = obsolete; bit 3 = 1 for Photoshop 5.0 and later, tells if bit 4 has useful information; bit 4 = pixel data irrelevant to appearance of document
Type:
- Byte
- Source:
-
(readonly) hasImage :Boolean
-
If the value is true, this layer has image data. If the value is false, this layer doen't have image data.
Type:
- Boolean
- Source:
-
(readonly) height :Int32
-
Height of layer
Type:
- Int32
- Source:
-
(readonly) id :Int32
-
ID of layer.
Type:
- Int32
- Source:
-
(readonly) isGroupLayer :Boolean
-
If this value is true, layer is group folder.
Type:
- Boolean
- Source:
-
(readonly) isTextLayer :Boolean
-
If this value is true, layer is text layer.
Type:
- Boolean
- Source:
-
(readonly) left :Int32
-
Location of layer. Left
Type:
- Int32
- Source:
-
(readonly) maskData :jLayerMaskAdjustmentLayerData
-
Layer mask and adjustment layer data
Type:
- Source:
-
(readonly) name :String
-
The name of layer.
Type:
- String
- Source:
-
(readonly) opacity :Byte
-
Opacity of layer
Type:
- Byte
- Source:
-
(readonly) parentLayer :jLayer
-
Parent layer of this layer.
Type:
- Source:
-
(readonly) rangeData :jRangeData
-
Data of range
Type:
- Source:
-
(readonly) right :Int32
-
Location of layer. Right
Type:
- Int32
- Source:
-
(readonly) top :Int32
-
Location of layer. Top
Type:
- Int32
- Source:
-
(readonly) type :Int32
-
Type of layer. 0 = any other type of layer, 1 = open "folder", 2 = closed "folder", 3 = bounding section divider, hidden in the UI
Type:
- Int32
- Source:
-
(readonly) visible :Boolean
-
The visibility of layer. Even if this value is true, if its parent is false, this layer will not be visible.
Type:
- Boolean
- Source:
-
(readonly) width :Int32
-
Width of layer
Type:
- Int32
- Source:
Methods
-
getActualVisibility() → {Boolean}
-
If the value is true, this layer is visible. If the value is false, this layer is invisible.
- Source:
Returns:
- Type
- Boolean
-
getChannelDatas() → {associativeArray}
-
Get channel data of layer. The value contains alpha, red, green, blue and mask.
- Source:
Returns:
- Type
- associativeArray
-
getImage() → {string}
-
Get image of layer. Return value is encoded by base64. Need to append prefix 'data:image/png;base64,' to display image on web browser.
- Source:
Returns:
base64- Type
- string
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.getLayers()[0].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>