Commit 539ca415 authored by Ryan LeFevre's avatar Ryan LeFevre

Add PNG export functions to Node

parent 03c5ccc3
This diff is collapsed.
...@@ -6,7 +6,7 @@ var start = new Date(); ...@@ -6,7 +6,7 @@ var start = new Date();
PSD.open(file).then(function (psd) { PSD.open(file).then(function (psd) {
psd.tree().descendants().forEach(function (node) { psd.tree().descendants().forEach(function (node) {
if (node.isGroup()) return true; if (node.isGroup()) return true;
node.layer.image.saveAsPng("./output/" + node.name + ".png").catch(function (err) { node.saveAsPng("./output/" + node.name + ".png").catch(function (err) {
console.log(err.stack); console.log(err.stack);
}); });
}); });
......
...@@ -4,7 +4,7 @@ _ = require 'lodash' ...@@ -4,7 +4,7 @@ _ = require 'lodash'
module.exports = class Node extends Module module.exports = class Node extends Module
@includes require('./nodes/ancestry.coffee') @includes require('./nodes/ancestry.coffee')
@includes require('./nodes/search.coffee') @includes require('./nodes/search.coffee')
# @includes require('./nodes/build_preview.coffee') @includes require('./nodes/build_preview.coffee')
@PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width'] @PROPERTIES: ['name', 'left', 'right', 'top', 'bottom', 'height', 'width']
......
module.exports =
toPng: -> @layer.image.toPng()
saveAsPng: (output) -> @layer.image.saveAsPng(output)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment