Live data from Hacker News

Psd.rb

layervault.tumblr.com

31–40 of 94 posts

Re: Psd.rb

#31
post #17

I just wrote a script with this that takes a directory of PSDs and outputs PNGs for each one. It took about 2 minutes. This is great.

Great, however, that was possible with ImageMagick before. Even more: ImageMagick can extract PSD layers as separate PNGs.

Re: Psd.rb

#32
post #10
post #2

I feel like this could be used to automatically convert a simple .psd web layout to non-shitty HTML and CSS.

Look up markupwand.com an YC alumni. The problem is harder than it looks. Now, I am not an expert in PSD format but a PSD that can be automatically converted to HTML has to be specifically formatted. For example, if you merge text layers with image layers, it becomes difficult to extract the information.

> The problem is harder than it looks.

markupwand.com is pivoting...

Re: Psd.rb

#33
post #30

This programmer has written about the PSD format in colorful detail: "Trying to get data out of a PSD file is like trying to find something in the attic of your eccentric old uncle who died in a freak freshwater shark attack on his 58th birthday." https://code.google.com/p/xee/source/browse/XeePhotoshopLoad... (ref: first link in the article)

I think that comment itself was posted on HN or somewhere -- I know I've seen it before.

It was a front-page story on HN, but four years ago: https://news.ycombinator.com/item?id=575122

Re: Psd.rb

#34

>Adobe has never produced an easy way for developers to work with the format. That's not entirely fair. Adobe has openly released a comprehensive description of the format which is, as far as I know, accurate. The problem is that the format itself is a heap of features piled on year after year with apparently no regard for doing things consistently.

joke: Legal wanted to open-source it, but was vetoed by Engineering.

But seriously, this kind of back-compatibility horror is the hallmark of success, where success means enduring.

Re: Psd.rb

#35
post #27
post #26

Earlier quoted context omitted.

But this way I don't have to keep paying $20/mo to Adobe CC so that I can run the script again next month.

I suspect that you could probably also manage it with GIMP/guile, but I don't suspect it would be particularly pleasant.

If you want to script it, ImageMagick or GraphicsMagick are probably a better bet than trying to hack up something with GIMP batch processing: http://www.imagemagick.com/www/formats.html

If you just want to do basic conversion ignoring layers, it's quite easy:

   for f in *.psd; do
     convert "$f" "${f%%.psd}.png"
   done

Re: Psd.rb

#36

This programmer has written about the PSD format in colorful detail: "Trying to get data out of a PSD file is like trying to find something in the attic of your eccentric old uncle who died in a freak freshwater shark attack on his 58th birthday." https://code.google.com/p/xee/source/browse/XeePhotoshopLoad... (ref: first link in the article)

Several years ago while writing a PSD parser in javascript, that comment block saved my sanity.

Re: Psd.rb

#37
Thank you very much for doing this! I wish all people hacking the PSD format would join forces and help with one project. There are too many partial implementations which scratch an itch instead of trying to be a full implementation.

Re: Psd.rb

#38
post #27
post #26

Earlier quoted context omitted.

But this way I don't have to keep paying $20/mo to Adobe CC so that I can run the script again next month.

I suspect that you could probably also manage it with GIMP/guile, but I don't suspect it would be particularly pleasant.

Gimp's support for PSD is understandably poor for the more advanced/modern features, so I wouldn't rely on it without being able to compare the output to something else. I use Apple's Preview utility to manually compare results.

Re: Psd.rb

#39
post #32
post #10

Earlier quoted context omitted.

Look up markupwand.com an YC alumni. The problem is harder than it looks. Now, I am not an expert in PSD format but a PSD that can be automatically converted to HTML has to be specifically formatted. For example, if you merge text layers with image layers, it becomes difficult to extract the information.

> The problem is harder than it looks. markupwand.com is pivoting...

isn't that the point?

Re: Psd.rb

#40
post #31
post #17

I just wrote a script with this that takes a directory of PSDs and outputs PNGs for each one. It took about 2 minutes. This is great.

Great, however, that was possible with ImageMagick before. Even more: ImageMagick can extract PSD layers as separate PNGs.

Sure. The difference is that with ImageMagick is getting all the flags right. Not to put down a powerful tool, but it isn't exactly memorable. In a script you can describe what's happening and customise it at any point without in-depth knowledge of the tool, and with a friendly CLI environment. I'd rather write 5 lines of Ruby than read up on the ImageMagick flags.
Post reply on HN