Live data from Hacker News

"PSD is not my favorite file format"

code.google.com

11–20 of 34 posts

Re: "PSD is not my favorite file format"

#11
post #7

I think Adobe made that on purpose to some extent. The less other programs are able to handle a full-featured psd, the more consumers will likely buy the full version of photoshop (ok, some might be getting it through other sources, but at least most businesses would choose the real Photoshop over other programs). Consider Open Office: As it handles only 99% of doc-files correctly, I found myself quickly buying the f…

I seriously doubt that Adobe made the spec all spaghetti'd on purpose. They probably just kept hacking on new features without cleaning old code, and eventually someone went "Our spec is a nightmare!". At this point, someone with decision making power considered things for a brief second, squinted his eyes, and said "good."

Re: "PSD is not my favorite file format"

#12
Having written code to load PSD files, I have some sympathy with that view.

However, one thing which is good about PSD is that they've put a lot of attention into making it very backwards compatible, to the extent of including the same data twice and useful bitmap renderings. This is very handy, because you don't have to support _everything_ to get an accurate import.

Re: "PSD is not my favorite file format"

#13

This somehow reminds me of a joke called BOOL TrackPopupMenu(...); in Windows that as per documentation returns an integer.

Win32 is full of such inconsistencies, for example:

    BOOL GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax);
returns:

> If the function retrieves a message other than WM_QUIT, the return value is nonzero.

> If the function retrieves the WM_QUIT message, the return value is zero.

> If there is an error, the return value is -1. For example, the function fails if hWnd is an invalid window handle or lpMsg is an invalid pointer. To get extended error information, call GetLastError.

Re: "PSD is not my favorite file format"

#14
IIRC, Photoshop has defaulted to saving as TIFF since version 7.0 (introduced over seven years ago). I guess they realized long ago that PSD had become an unmaintainable mess.

TIFF was designed to be extensible with custom data chunks and it predates PSD, so it probably would have been the best choice all along. I'd guess Adobe decided against it for "NIH" reasons: TIFF was originally created by Aldus, a competitor in the desktop publishing market... But Adobe ended up acquiring Aldus in the mid-'90s so that reason vanished, leaving PSD and the billions of images saved in that format as a depressing monument of obsolete corporate politics. (Of course the harm done is very limited, since those affected by PSD's problems are just developers -- users don't care as long as their files are saved and opened reliably and quickly.)

Re: "PSD is not my favorite file format"

#15
post #10
post #9

Sounds to me like the product of many years of evolution with many developers working on it, and all that at a large company. Working at a large company myself, I see how these messed up pieces of code / specifications come into being every day.

Exactly. What version of Photoshop dear HN reader was your first? Think about all the features that have been added since then and how hard it must be to maintain even a modicum of backwards compatibility.

Another thing to consider: a file format as popular as PSD probably had a great deal of interest from competitors. Sometimes file formats get obfuscated simply for the purpose of breaking the other guys' import filters.

I've seen this behavior in the file format of an extremely popular application. IIRC, in one section, there were magic bytes that told you the alignment of other blocks that told you how to look up the version of the algorithms that you were supposed to use to unpack the binary data blobs that held resource data. By jiggling around the various forms of indirection, it was possible to make the file formats nigh indecipherable from version to version, while still maintaining backwards compatibility.

Naturally, the parsing code was a total nightmare.

Re: "PSD is not my favorite file format"

#16
I think we all hit points, like this, at some point in our coding where we get so frustrated with something we write a huge attack in comment form in the middle of the code. I think it's because we don't really have anyone to rant at whilst we're working.

Working in an environment where many people (often including the target of the rant) will see my code I find myself having to go through it before check-in to source control and remove many of these rants. Oh to be in a position where only I and my closest allies will see my frustrations!

Re: "PSD is not my favorite file format"

#17

This somehow reminds me of a joke called BOOL TrackPopupMenu(...); in Windows that as per documentation returns an integer.

Win32 is full of such inconsistencies, for example: BOOL GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax); returns: > If the function retrieves a message other than WM_QUIT, the return value is nonzero. > If the function retrieves the WM_QUIT message, the return value is zero. > If there is an error, the return value is -1. For example, the function fails if hWnd is an invalid window handle…

I think that many of these inane inconsistencies in Win32 stem from the desire to sneak in "just a bit more features" while officially maintaining full compatibility with Win16.

In the book Showstopper!, which documents the creation of Windows NT (a rather fascinating read), there's a revealing passage about how Microsoft got this Windows backwards compatibility religion. Windows had been intended to be a transitional DOS-based system on the way to OS/2, but then Windows 3.0 became an enormous success almost overnight, and Microsoft decided to break up with IBM over OS/2 development.

NT had been intended to have "multiple personalities" in the form of multiple user-level APIs, with OS/2 as the primary one. The breakup had left them without a 32-bit API. With the success of Windows 3 depending to such a large degree on backwards compatibility with DOS, it made sense that the new API should match the existing Windows API as closely as possible. Besides, there was no time to spend on redesigning anything -- they couldn't afford to let IBM's 32-bit OS/2 to steal the market before NT.

To ensure that the new "Win32" matched the old "Win16" as closely as possible, it's mentioned in the book that any API changes had to be presented for approval by Ballmer himself...! Perhaps the group in charge of the GetMessage() function figured that they could manage just fine with the existing BOOL return type (which is just a typedef for int), rather than risk Ballmer's wrath over the cosmetic API change.

Re: "PSD is not my favorite file format"

#19
post #3

// No, PSD is an abysmal format. Having worked on this code for several weeks now, my hate for PSD has grown to a raging fire that burns with the fierce passion of a million suns. // 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... I am spending a lot of time imagining amusing fates for th…

The key to the jokes are to be very specific in your examples. Dave Barry talked about this.

Re: "PSD is not my favorite file format"

#20
post #14

IIRC, Photoshop has defaulted to saving as TIFF since version 7.0 (introduced over seven years ago). I guess they realized long ago that PSD had become an unmaintainable mess. TIFF was designed to be extensible with custom data chunks and it predates PSD, so it probably would have been the best choice all along. I'd guess Adobe decided against it for "NIH" reasons: TIFF was originally created by Aldus, a competitor i…

I have CS3 here at work, CS2 at home plus I have used every version from 5 up and I don't ever remember it defaulting to TIFF. In fact TIFF is at the very bottom of the list in the save as window.

Is it using tiff internal and still using the PSD extension?

Post reply on HN