"PSD is not my favorite file format"
code.google.com
code.google.com
// 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 the people responsible for this Rube Goldberg of a file format.
Woah. This guy is a natural poet. If I were the computer, my loop might have skipped an iteration.
Although it could just be that... if someone takes the time to write a humorous comment, they probably give a shit enough to not leave slop all over the file.
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.
Fixing things like that involves quite a bit of both time and suffering, particularly without good test infrastructures.
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!
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 full MS-version, because you can't just manage that hassle in daily business life.
EDIT: I forgot: Great read, anyhow!!!
Business as usual in big monopolist land, really. The minnows will eventually bring them down anyway.
-May god have mercy on all our souls for this code.
+Whereas once I was lost, now I am found.
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.
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.)
Is it using tiff internal and still using the PSD extension?
Anyway, Photoshop guru Jeff Schewe recommends TIFF over PSD: http://www.luminous-landscape.com/forum/lofiversion/index.ph...
"Everything that can be saved in a PSD can also be save in a layered Tiff-6.0 file format...everything, paths, channels, layers, transparency, layer effects...there is nothing that PSD has "special" any longer and when that happened, Bruce and several engineers and I realized that the end of the Photoshop native file format had arrived.
"Tiff has better compression (zipped tifs), can save everything that a PSD can save and be as large as 4 gigs in size (I think PSD is still limited to 2 gigs). Tiff is publicly documented where PSD requires a special NDA to access the internals. As a result, tiff is a more "archival" format while losing nothing by being used." [- - ] "So, since Photoshop CS, only PSB is a format unique to Photoshop which does not fall under the heading of having to work with the Suite...and when once looks at all the pluses and minus, I think layered TIFF's offer the best file format for pixels today-unless you are talking raw and then it's DNG-which is essentially, a TIFF-EP file, a variant of Tiff-6.
"Which was one reason that Mark Hamburg, when Lightroom was first released in beta fought really, really hard AGAINST allowing PSD files into Lightroom. He lost that battle.
"So, at best figure that PSD and TIFF are equal but since TIFF is a documented file format and PSD isn't, I lean towards using tiffs whenever possible...because PSD files, suck-and have since Photoshop CS."
BOOL TrackPopupMenu(...);
in Windows that as per documentation returns an integer. 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.
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.
r11 by paracelsus on Sep 11, 2007 Diff
Photoshop loader is DONE for now, fuck you AdobeOut of 500 lines, about 30 lines are spent on the rant, and there are almost no comments of any significance anywhere else, not even a file header to explain what the class is and how it should be used.
(I don't think it's Subversion itself; trying the same thing on another svn-over-http server I have handy doesn't produce the same results.)
Verbose. Hope I never have to work with PSD anywhere except in my happy photoshop 7 (yeah the upgrade wasn't worth it, and I use WINE so...)
If there are two different ways of doing something, PSD will do both, in different places. It will then make up three more ways no sane human would think of, and do those. PSD makes inconsistency an art form...
Earlier, I tried to get a hold of the latest specs for the PSD file format. To do this, I had to apply to them for permission to apply to them to have them consider sending me this sacred tome. This would have involved faxing them a copy of some document or other, probably signed in blood. I can only imagine that they make this process so difficult because they are intensely ashamed of having created this abomination..."
Awesome comments!!!
I can feel the passionated hate to PSD file format!, even althought I never had to work with that.