PSD-parser
09.07.2007 Alexey KviringPhotoshop with its PSD files is a standart de-facto. The game wants to read all that additional parameters, like pivot point, slices and so on. We decided to use separate layers to store this info. Then is came to a need of PSD-parser. We did’t found any real quality parsers, so we made it by ourselves in a week.
Here is an example of using this neat thing:
PSDParser parser = new PSDParser(new FileInputStream("image.psd")); PSDLayerAndMask layerAndMask = parser.getLayerAndMask(); List layers = layerAndMask.getLayers(); List images = layerAndMask.getImageLayers(); int i = 0; for (PSDLayerStructure layer : layers) { PSDLayerPixelData pixelData = images.get(i); BufferedImage image = pixelData.getImage(); if (image != null) ImageIO.write(image, "png", new File(layer.getName() + ".png")); i++; }
Sourse
Sourse can be downloaded freely under APACHE LICENSE.
Features: all layers export (incl. main), main file info, full slices support.
Use this on your own risc, and we’ll be glad to hear any comments too (bugs, ideas).

28.10.2008 в 23:34
I was looking for a real FREE-OF-CHARGE PSD parser and finally I found it ! This is such a BIG gift which you guys ever created. This would save me and others from reinvent the wheel.
I was using the ImageRO to deal with the PSD parser but it’s messages bout something like “liences”,”expired”… made me sick. I was intend to read and write my own parser but bad news is that I had no documents bout the PSD at all… Thank and double, triple thanks you again, you guys lightened up my cruel, miserable life. Keep up the good works, hope you all the best.
29.10.2008 в 17:41
thanks Niha I would have never seen this without you
10.12.2008 в 00:55
Niha… how did you download the source? I would like to give this a try, but I don’t know what that .7z file type is. Any help is welcome.
10.12.2008 в 01:08
SkyPainter, 7z is an archive format. Check this site: http://www.7-zip.org/
17.12.2008 в 00:08
Thanks for the info Mikhail.
On another note, this is pretty cool. How can I apply layer effects to the parsed layer image? I see how the image is extracted in the Image Resource Blocks, however I can’t figure out how I could apply an effects layer to an image resource block. For example, create a text layer in a psd file and then apply a drop shadow effect to the text layer. The image that gets parsed out has the text, however, the drop shadow is not in the image itself. How can I apply the drop shadow to the image in the resource block? Any help is appreciated guys.
SkyPainter
19.12.2008 в 15:15
It seems like the only way is to merge (or rasterize, I’m not quite familiar with Photoshop) an effect with the layer. This parser is very simple, it just extracts layers from a psd-file.
16.04.2009 в 23:56
Does anybody knows how to implement this “rasterize” ?
I really need the image resource plus the layer effects…