Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
psd.js
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
regiostart
psd.js
Commits
d9eb995e
Commit
d9eb995e
authored
May 05, 2014
by
Ryan LeFevre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add asynchronous open
parent
ad21712f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
10 deletions
+21
-10
parse.js
examples/parse.js
+5
-7
psd.coffee
lib/psd.coffee
+7
-0
layer_mask.coffee
lib/psd/layer_mask.coffee
+9
-3
No files found.
examples/parse.js
View file @
d9eb995e
var
PSD
=
require
(
'../'
);
var
PSD
=
require
(
'../'
);
psd
=
PSD
.
fromFile
(
'./examples/images/example.psd'
);
psd
=
PSD
.
open
(
'./examples/images/example.psd'
,
function
(
psd
)
{
psd
.
parse
(
);
console
.
log
(
psd
.
header
.
export
()
);
console
.
log
(
psd
.
tree
().
children
()[
0
].
children
()[
0
].
nextSibling
().
export
());
console
.
log
(
psd
.
header
.
export
()
);
}
);
// psd.image.saveAsPng('./output.png').then(function () {
// psd.image.saveAsPng('./output.png').then(function () {
// console.log("Finished!");
// console.log("Finished!");
// });
// });
\ No newline at end of file
console
.
log
(
psd
.
tree
().
children
()[
0
].
children
()[
0
].
nextSibling
().
export
());
\ No newline at end of file
lib/psd.coffee
View file @
d9eb995e
...
@@ -13,6 +13,13 @@ module.exports = class PSD
...
@@ -13,6 +13,13 @@ module.exports = class PSD
Root
:
require
(
'./psd/nodes/root.coffee'
)
Root
:
require
(
'./psd/nodes/root.coffee'
)
@
fromFile
:
(
file
)
->
new
PSD
fs
.
readFileSync
(
file
)
@
fromFile
:
(
file
)
->
new
PSD
fs
.
readFileSync
(
file
)
@
open
:
(
file
,
cb
)
->
fs
.
readFile
file
,
(
err
,
data
)
->
throw
err
if
err
?
psd
=
new
PSD
(
data
)
psd
.
parse
()
cb
(
psd
)
constructor
:
(
data
)
->
constructor
:
(
data
)
->
@
file
=
new
File
(
data
)
@
file
=
new
File
(
data
)
...
...
lib/psd/layer_mask.coffee
View file @
d9eb995e
...
@@ -15,6 +15,14 @@ module.exports = class LayerMask
...
@@ -15,6 +15,14 @@ module.exports = class LayerMask
return
if
maskSize
<=
0
return
if
maskSize
<=
0
@
parseLayers
()
@
parseGlobalMask
()
@
layers
.
reverse
()
@
file
.
seek
finish
parseLayers
:
->
layerInfoSize
=
Util
.
pad2
@
file
.
readInt
()
layerInfoSize
=
Util
.
pad2
@
file
.
readInt
()
if
layerInfoSize
>
0
if
layerInfoSize
>
0
...
@@ -27,6 +35,4 @@ module.exports = class LayerMask
...
@@ -27,6 +35,4 @@ module.exports = class LayerMask
for
i
in
[
0
...
layerCount
]
for
i
in
[
0
...
layerCount
]
@
layers
.
push
new
Layer
(
@
file
,
@
header
).
parse
()
@
layers
.
push
new
Layer
(
@
file
,
@
header
).
parse
()
@
layers
.
reverse
()
parseGlobalMask
:
->
\ No newline at end of file
@
file
.
seek
finish
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment