Live data from Hacker News

Psd.rb

layervault.tumblr.com

61–70 of 94 posts

Re: Psd.rb

#61

I have been trying to do this from last 3 months. But I intend to make modifications to layers (turn on or off, change colors) and export to PNG. When I saw Psd.rb I thought it is done. But it just exports the channel data saved by Photoshop. So our modifications wont reflect in it.

Use extendscript or the creative suite extension builder SDK.

Re: Psd.rb

#62
I reckon a good tool (that this psd.rd wouldn't actually help write, but), would be one that rendered an html/css page - and exported a layered PSD, so you could prototype an app, render it to .psd and send it to your designer friend to make it look rad.

Re: Psd.rb

#64
post #28

Does anyone know of a similar tool for Python? Not trying to start a Ruby/Python fight or anything; Python just happens to be my preferred language.

You can access ruby code from python ( throuh jython and jruby) and the process is relatively seamless.

or check out psdparse on github ( there are others out in the wild )

Re: Psd.rb

#65
post #50

Earlier quoted context omitted.

"Just use Ruby" isn't always the best option; if you have a large base of Python code, it's probably preferable to use Python directly rather than using the subprocess module. Also, a port would be fairly straightforward. Some combo of the struct/ctypes modules (depending on how complicated the data structures are) would make a transliteration pretty simple.

A "large base of Python code" would not be my main reason for eschewing other languages: - Unfortunately psd.py doesn't seem to exist. Tell me, what is less effort: Implementing that, or building a small app/service that performs the functionality you need using existing tools? - Also I'd consider the suitability of a given technology before this too, e.g. on my current project there is a lot of Ruby code, but it's a…

> Tell me, what is less effort: Implementing that, or building a small app/service that performs the functionality you need using existing tools?

I think it depends on your use case. In certain cases, you want to do work inline. In other cases, you want to do PS manipulation in the background. I could imagine projects that go in either direction. If I had a large Python desktop application, I'd port the code. If I had a Django application that wanted to do background processing of PS documents, I'd put the work on a queue and have Ruby take care of the messy bits.

> Also I'd consider the suitability of a given technology before this too, e.g. on my current project there is a lot of Ruby code, but it's a major bottleneck in one of our services performing a particular task. We rewrote that service in Clojure and it performs orders of magnitude faster and uses orders of magnitude less memory.

I take a different approach. If I find a bottleneck in Python code, I use ctypes or write a C extension. I'd do the same thing in Ruby. I'm hesitant to deploy multiple runtimes, since I worry about security updates, etc. If I were on JRuby, Clojure would be a natural fit -- I'd only be deploying one JVM.

Re: Psd.rb

#66
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.

We've actually solved this and will be launching in about a week. We've been working on it for over a year now.

It runs inside Photoshop (there is no upload stage nor do you have to open up separate software) and it generates HTML and CSS that looks like a designer wrote it and slices up all your images. It also outputs LESS, SASS, HAML, Slim, Jade and I think there are some other formats I may be forgetting.

Text is output as text. If you use a Google font, it automatically links the fonts in for you.

It does not use absolute positioning so if you modify things like text and it grows taller or shrinks shorter, other items will be positioned properly (initially we did it with absolute positioning but later I figured out an algorithm to make it work the way it should, even with overlapping elements).

It's definitely not an easy problem to solve (hence why we've been working on it for over a year although not full time).

We've done some outputs now and the results are amazing.

I would link you to the website but it looks so bad right now that I don't want to show it. Anyways, we will launch in about a week so look for an announcement. If you have any questions about it, please leave a comment.

Sunny

Re: Psd.rb

#68
post #61

I have been trying to do this from last 3 months. But I intend to make modifications to layers (turn on or off, change colors) and export to PNG. When I saw Psd.rb I thought it is done. But it just exports the channel data saved by Photoshop. So our modifications wont reflect in it.

Use extendscript or the creative suite extension builder SDK.

Unfortunately I want it to run on a Linux server and I don't want any UI as it needs to be a service.

Re: Psd.rb

#69
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.

Could you provide your ImageMagick command, so we don't have to navigate the flag-infested waters?

Re: Psd.rb

#70
This is a great example of why open source is brilliant. Everybody wins. We get a PSD parser. LayerVault benefits from the world improving they're core product too.
Post reply on HN