# PSD parser (incomplete)

**URL:** <https://www.ruby-forum.com/t/psd-parser-incomplete/70142>\
**Category:** Ruby\
**Created:** [September 27, 2006, 12:58am UTC](https://www.ruby-forum.com/t/psd-parser-incomplete/70142 "2006-09-27T00:58:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ilmari\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/a587f6/32.png) [@Ilmari\_H](https://www.ruby-forum.com/u/Ilmari_H)\
**Post date:** [September 27, 2006, 12:58am UTC](https://www.ruby-forum.com/t/psd-parser-incomplete/70142/1 "2006-09-27T00:58:16Z")

</div>

Hi,

I’ve written an incomplete PSD parser in ruby, using the Photoshop 6.0  
file format  
docs. It can handle paths, some adjustment layer types (curves work at  
least, others undertested, sadly), most image descriptors, and  
generally split the psd file into a big  
hash with descriptive (and hopefully helpful) key names.

The implemented part is roughly pages 8-26 in the PS 6 file format spec  
pdf +  
curves, levels, hue&saturation. Levels and hue&sat adjustment layers  
untested.  
There is some value bug in the path parsing part that I forgot to write  
down 😉

Actual layer & channel pixmap data is not decompressed, so implementing  
RLE &  
ZIP decompression needed for any actual image manipulation.

Tested with a ~60 layer 21MB psd and ~70 layer 4.5MB psd.

Sample output with long strings replaced with their lengths:  
[http://librend.rubyforge.org/finalsize3.psd.txt](http://librend.rubyforge.org/finalsize3.psd.txt)

I don’t know if I have time or will to continue the parser, so releasing  
the code with the distant hope that someone might find it useful.

[http://librend.rubyforge.org/psd\_parser.tar.gz](http://librend.rubyforge.org/psd_parser.tar.gz)
