Live data from Hacker News

Psd.rb

layervault.tumblr.com

51–60 of 94 posts

Re: Psd.rb

#51

Earlier quoted context omitted.

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

You can use find/xargs for this. It'll be faster because you can parallelize it with the -P option, for example, for a 4-core machine: find . -iname "*.psd" -print0 | xargs -0 -P 4 -n 1 -I I convert I I.png For best results, change the number "4" in the above command to the number of cores you have.

The same with GNU Parallel, only it picks the right number of cores automatically and removes .psd from the file name:

  find . -iname "*.psd" -print0 | parallel -0 convert '{}' '{.}.png'

Re: Psd.rb

#52
post #50

Earlier quoted context omitted.

Just use Ruby for this. I prefer Ruby, but there are times I will pick Python instead because it has better libs for what I need to do, e.g. numerical and scientific libs.

"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 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.

Re: Psd.rb

#53

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

Similar to a Word .doc? Who's worked with both, is it Better, or worse?

Re: Psd.rb

#54

Earlier quoted context omitted.

The file spec released by Adobe ( http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/ ) is actually outdated, wrong in some places, and can be incredibly vague at times.

A bit off-topic, but is there a spec for Illustrator files? It seems the only one I see on Google is from an old version of AI...

Some AI files can read as PDF (try to rename them and see if your reader can open it).

Re: Psd.rb

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

I would've liked to see it in Go, but alas.

Re: Psd.rb

#56
post #30

Earlier quoted context omitted.

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

Thanks for the link. I still remember that thread and the original post. It was indeed awesome.

Re: Psd.rb

#57
post #48

Does anyone else think it's weird that they decided to make this library in Ruby? It drastically cuts down on the audience. Why not C/C++ with wrappers for all the dynamic languages? EDIT: nevermind, it makes sense now that I see their main product is a version control system for designers. Still, it would be nice to see this ported to native code some day.

Most of the work is done, get off your ass and start porting.

Re: Psd.rb

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

Re: Psd.rb

#60
post #48

Does anyone else think it's weird that they decided to make this library in Ruby? It drastically cuts down on the audience. Why not C/C++ with wrappers for all the dynamic languages? EDIT: nevermind, it makes sense now that I see their main product is a version control system for designers. Still, it would be nice to see this ported to native code some day.

Most of the work is done, get off your ass and start porting.

I might just accept that challenge!
Post reply on HN