Convert PSD to PNG via Node.js
Automating and manipulating media is a fascination of mine, partly because I don’t understand the magic behind it and partly because the idea of turning one thing into another is fun and useful. That latest media tool that has piqued my interest is a JavaScript tool called psd.js.
psd.js is a project that allows you to read PSD files, including:
- Document structure and size
- Layer/folder size + positioning, names, visibility, and opacity
- Font data (via psd-enginedata)
- Text area contents
- Font names, sizes, and colors
- Color mode and bit-depth
- Vector mask data
- Flattened image data
- Layer comps
What the media converter and JavaScript lover in me found most awesome was one basic feature: converting a PSD to PNG with JavaScript!
var PSD = require('psd');
PSD.open('homepage.psd').then(function (psd) {
return psd.image.saveAsPng('homepage.png');
}).then(function () {
console.log('Finished!');
});
That’s a nice, tidy API there and I love that it doesn’t require anything other than JavaScript (many other Node.js image libraries require ImageMagick on the machine).






