Live data from Hacker News

Psd.rb

layervault.tumblr.com

71–80 of 94 posts

Re: Psd.rb

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

A shameless plug: you can give https://github.com/kmike/psd-tools a try.

I've read PSD.rb docs and a bit of its code; the implementation is one of the best and complete I've seen (I've checked almost all PSD reader implementations some time ago).

But it seems that psd-tools is mostly on par with PSD.rb. It also have some features that PSD.rb doesn't have, e.g. full support for 'zip-with-prediction' compression, including 32bit layers. Such images are very common in practice, and parsing them is not easy because the compression format is not documented anywhere, and "zip-with-prediction" for 8 and 16bit layers is totally different from "zip-with-prediction" for 32bit layers (for 32bits it is really tricky).

If PSD.rb authors are reading this, I urge them to check the decompression code in psd-tools (https://github.com/kmike/psd-tools/blob/master/src/psd_tools...) or in Paint.NET PSD plugin (http://psdplugin.codeplex.com/) to not waste the time.

psd-tools also knows how to export individual layers, and there is an experimental support for exporting layer groups; it seems that this is not implemented in PSD.rb yet.

PSD.rb has some features that psd-tools doesn't have, e.g. it parses "Font data" which is really cool and hard because the format is not described anywhere.

Re: Psd.rb

#72
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…

> Unfortunately psd.py doesn't seem to exist.

This is just plain wrong. There are many Python readers for PSD format:

* https://github.com/kmike/psd-tools

* https://github.com/jerem/psdparse

* https://code.google.com/p/pypsd/

* PIL and Pillow can read PSD files.

I'm biased because I wrote psd-tools, but I think psd-tools API is quite simple, and it has some features that PSD.rb doesn't have, e.g. it supports more PSD compression formats (actually, all of them) and can export individual layers and layer groups as images. It also has more tests than PSD.rb and more PSD files in testing suite.

Re: Psd.rb

#73
post #31

Earlier quoted context omitted.

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.

I'd rather look up the ImageMagick flags and write a simple 5 line shell wrapper for my specific use case than learn an API and write Ruby.

Re: Psd.rb

#74

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

As noted, newer illustrator files are just PDF's (perhaps with extra data for editing).

Older illustrator files are in fact, EPS files. This is somewhat tricky since, an EPS is not actually so much a data format as it is a turing complete programming language. Sooo... yeah, who knows what black magic they did to pull off reliably reading and writing it.

Re: Psd.rb

#75
These are great news for developers and an easy way to communicate between designers with developers. Is the beginning of a solution for a big problem.

Re: Psd.rb

#76
post #71
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.

A shameless plug: you can give https://github.com/kmike/psd-tools a try. I've read PSD.rb docs and a bit of its code; the implementation is one of the best and complete I've seen (I've checked almost all PSD reader implementations some time ago). But it seems that psd-tools is mostly on par with PSD.rb. It also have some features that PSD.rb doesn't have, e.g. full support for 'zip-with-prediction' compression, inclu…

I checked out psd-tools and it's good. Any chance of you adding their features to yours or vice versa? I know I know, I should do it myself and do a pull request, but just asking if you are planning to?

Re: Psd.rb

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

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…

There are a bunch of those tools which run inside PS, but the point is that I really don't want to run PS. Ever. My designers do and now I have to pay / upgrade licenses too because there is no solution. I think PS is overused and abused for anything 'design' while for programmers it's an annoyance more often than not.

Re: Psd.rb

#78
post #72

Earlier quoted context omitted.

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…

> Unfortunately psd.py doesn't seem to exist. This is just plain wrong. There are many Python readers for PSD format: * https://github.com/kmike/psd-tools * https://github.com/jerem/psdparse * https://code.google.com/p/pypsd/ * PIL and Pillow can read PSD files. I'm biased because I wrote psd-tools, but I think psd-tools API is quite simple, and it has some features that PSD.rb doesn't have, e.g. it supports more PSD…

Nice. Obviously I didn't look too hard hence "doesn't seem to exist". My main point was against reimplementing something already extant just because you have a swathe of code in a given language.

Re: Psd.rb

#79
post #71
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.

A shameless plug: you can give https://github.com/kmike/psd-tools a try. I've read PSD.rb docs and a bit of its code; the implementation is one of the best and complete I've seen (I've checked almost all PSD reader implementations some time ago). But it seems that psd-tools is mostly on par with PSD.rb. It also have some features that PSD.rb doesn't have, e.g. full support for 'zip-with-prediction' compression, inclu…

Nice! We should work together.

Re: Psd.rb

#80
post #71

Earlier quoted context omitted.

A shameless plug: you can give https://github.com/kmike/psd-tools a try. I've read PSD.rb docs and a bit of its code; the implementation is one of the best and complete I've seen (I've checked almost all PSD reader implementations some time ago). But it seems that psd-tools is mostly on par with PSD.rb. It also have some features that PSD.rb doesn't have, e.g. full support for 'zip-with-prediction' compression, inclu…

I checked out psd-tools and it's good. Any chance of you adding their features to yours or vice versa? I know I know, I should do it myself and do a pull request, but just asking if you are planning to?

Unfortunately I'm currently very busy with other projects, so I probably won't implement PSD.rb features myself anytime soon.

I'm trying to provide feedback for psd-tools pull requests, merge them and release new psd-tools versions in timely manner; the testing suite also helps here, so you know, pull requests are welcome :) Most improvements over last 6 months came from pull requests submitted by other great people.

I think that the "reader" part of library is feature-complete. psd-tools reads all the information, but it doesn't decode all Photoshop data structures (some of them are available only as binary blobs). So I think implementing a PSD.rb feature will most likely involve checking PSD.rb code and decoding a binary blob (already loaded to memory) to a Python data structure.

Post reply on HN