as3-psd-parser is a lib to parse PSD (Photoshop) files. It works by instantiating the PSDParser
class, then calling the parse method passing the content of a PSD file in byte array format. The parsing is synchronous so after that line, you will already have all the file/layers info available. A loaded and parsed file will have their original layers, with their blend modes, visibility , lock, alpha , layer effect etc. Regarding the PSD file, the lib is able to parse canvas width x height, file color information (number of color channels, color depth, color mode), file’s composite bitmap snapshot and all layers and layer folders.
The lib is able to parse the following layers info: bitmap data, bounds and position, name, ID, blend mode, colour channels, alpha, filter, extra properties (e.g. isLocked, isVisible, clipping applied) and type (normal, folder).
Sample
var psdParser :PSDParser = PSDParser.getInstance(); psdParser.parse(file.data); var layersLevel :Sprite = new Sprite(); this.addChild(layersLevel); for (var i : Number = 0;i < psdParser.allLayers.length; i++) { var psdLayerm :PSDLayer = psdParser.allLayers[i]; var layerBitmap_bmp :BitmapData = psdLayer.bmp; var layerBitmap :Bitmap = new Bitmap(layerBitmap_bmp); layerBitmap.x = psdLayer.position.x; layerBitmap.y = psdLayer.position.y; layerBitmap.filters = psdLayer.filters_arr; layersLevel.addChild(layerBitmap); } var compositeBitmap:Bitmap = new Bitmap(psdParser.composite_bmp); layersLevel.addChild(compositeBitmap);
RT @as3gamegears: New: as3-psd-parser (lib to parse PSD files) http://t.co/amhMBozeFx #as3 #flash #gamedev
RT @as3gamegears: New: as3-psd-parser (lib to parse PSD files) http://t.co/amhMBozeFx #as3 #flash #gamedev
Thanks!
This is great!
What about working with smart objects?
You’re welcome! I think the lib doesn’t support smart objects (there was a comment requesting it in 2012, but no response).