Originally published at posts.postlight.com on March 2, 2016. A typical computer file has some kind of format — a set of rules for how it should open, what can be changed, and what data gets saved. For example, HTML is a kind of file format. An HTML file is something that a web browser knows how to display. CSS files describe how to format what appears on a web browser’s screen. And so forth.
But there are many other kinds of files. One of the most important kinds is the Photoshop file format. You can read the entire specification, current as of 2013, updated on Adobe’s website. The more of it you read, the more you learn about the history of commercial software. Because Photoshop has to be backwards-compatible, and it has to deal with every kind of image imaginable, and it ultimately has to do that perfectly for millions of people.
You might think that a Photoshop file is just, like, a bunch of pixels. But not at all —
The Large Document Format (8BPB/PSB) supports documents up to 300,000 pixels in any dimension. All Photoshop features, such as layers, effects, and filters, are supported by the PSB format.
I never really thought about how big a Photoshop file could be; it turns out that at 150 DPI, a file can be 167 feet tall — roughly as tall as the world’s tallest water slide.
Quiz: Can you match the horrible splash graphic to the version of Photoshop?
Here are the splash graphics for Photoshop versions 1–7. Do you know which weird eye-and-loupe weirdness goes with which version?
Answer key at the bottom of this post.
As you look through the file description you can see the magic of Photoshop gently stripped away. Duotones? Layers? Spot colors? All just numbers, really. Vanishing points, alpha masks — the same. Each individual component makes sense but it’s a lot to internalize.
I can’t really discuss Photoshop without also calling out to this comment from the Mac OS image loader Xee, as it appears in source code last updated in 2009, which I will reproduce in its entirety.
At this point, I’d like to take a moment to speak to you about the Adobe PSD format. PSD is not a good format. PSD is not even a bad format. Calling it such would be an insult to other bad formats, such as PCX or JPEG. 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.
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 too. PSD makes inconsistency an art form. Why, for instance, did it suddenly decide that *these* particular chunks should be aligned to four bytes, and that this alignement should *not* be included in the size? Other chunks in other places are either unaligned, or aligned with the alignment included in the size. Here, though, it is not included. Either one of these three behaviours would be fine. A sane format would pick one. PSD, of course, uses all three, and more.
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. That last detail may not be important for the purposes of the simile, but at this point I am spending a lot of time imagining amusing fates for the people responsible for this Rube Goldberg of a file format.
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. I was naturally not gullible enough to go through with this procedure, but if I had done so, I would have printed out every single page of the spec, and set them all on fire. Were it within my power, I would gather every single copy of those specs, and launch them on a spaceship directly into the sun.
PSD is not my favourite file format.
That’s good and interesting software criticism! But also testament to how long Photoshop has stuck around (since 1990), how it can’t be avoided, and how every Photoshop file carries with it the terrible burden of technology history, which this poor programmer had to face down in their spare time. What you see on your desktop is a simple preview icon; what lurks inside is the result of terrible imperatives. And Photoshop is so important that the Computer History Museum has preserved its source code. Grady Booch, a very famous programmer, looked through the source code. He said:
Having the opportunity to examine Photoshop’s current architecture, I believe I see fundamental structures that have persisted, though certainly in more evolved forms, in the modern implementation. Tiles, filters, abstractions for virtual memory (to attend to images far larger than display buffers or main memory could normally handle) are all there in the first version. Yet it had just over 100,000 lines of code, compared to well over 10 million in the current version! Then and now, much of the code is related to input/output and the myriad of file formats that Photoshop has to attend to.
It is only when you get to the very tail end of Photoshop’s format description that you find the picture. It’s a very short section of the spec. Here’s how they describe the way image data works:
“First all the red data, then all the green data, etc.”
That’s pretty much it! I love that “etc.” — the image itself is essentially an afterthought, barely worth documenting. It’s the rest of the stuff, like actions or special effects or animations, that matters to Photoshop’s creators. The actual, real picture section is — in total — 137 words long — less than 1% of the entire specification (and barely 14% of a picture’s typical valuation at a thousand words).
When I was making the overwhelming screenshot at the top of this post (gradients! drop shadows! Futura!) I made an image in Photoshop version 4 (1996, codename “Big Electric Cat”), transferred it to my desktop, and it opened just fine 20 years later.
Today’s GIF Battles
- It’s on iTunes (with clean lyrics). Here’s the direct link to the episode.
- Soundcloud works okay now.
- The canonical RSS feed is available.
- There’s an automatically-generated page for it at LibSyn, which is apparently where all the podcasts live.
- We also posted it to LinkedIn but who in God’s name knows what happens when you post things there.
- Track Changes: Apple vs. the FBI and Paul vs. Rich (Tue, Mar 01)
- Risks We Accept (Mon, Feb 29)
- Nine fine vines (Fri, Feb 26)
- Meet our new podcast, Track Changes (Thu, Feb 25)
Answer to quiz: A: 7, B: 3, C: 1, D: 5, E: 6, F: 4, G: 2.