15 ms·
PSD was never intended to be a data interchange format: it is the serialization format of a single program that has more individual unrelated features that actu
by saurik 14y ago
PSD was never intended to be a data interchange format: it is the serialization format of a single program that has more individual unrelated features that actual people rely on than almost any other piece of software and has maintained striking amounts of backwards compatibility and almost unbroken forwards compatibility during its over two decades of existence. This product's "file format" needs to be critiqued in this context, along with similar mega-programs like Office.
I am thereby having a difficult time fathoming why anyone would think that a PSD file is thereby going to be some well-organized file format that they should easily be able to parse from their own application is just naively wishful thinking: even other products from Adobe have limitations while opening these files; to truly manipulate these files you really need to be highly-compatible with Photoshop's particular editing model (hence the conceptual difference between these two classes of file format).
- wmf 14y agoPerhaps some people care more about what would be convenient to them than whatever laziness or lock-in Adobe intended. Or maybe they believe that Photoshop might have better interchange with future versions of itself if its file format was sane.
- shrughes 14y agoWhat decade was Photoshop first written in and how long did it take to open a file?
- saurik 14y agoThis is a very important point to make: data interchange formats typically much slower to manipulate and require much more RAM to do so, as they will require mapping back and forth to the internal data structures actually used at runtime. If you take a look at an older (pre-"x" formats) Office document, you will find a lot of its complexity (in addition to the aforementioned backwards compatibility and "numerous unrelated features" issue) relates to figuring out how to edit and resave enormous documents quickly.
- scrumper 14y agoExactly. I clearly remember working on a 20MB PSD file in the mid 1990s (a restoration job done on a borrowed Mac of a badly damaged photo of my grandfather; the picture still sits on my mother's dressing table.) That took an absolute age to load and I know there wasn't much more RAM than that in the machine. It worked well enough though. Old formats like PSD are better viewed as archaeological artefacts than as exemplars of some elegant ideal.
- CoolGuySteve 14y agoThis is true, but there are container formats just as old like .mov that are quite nice to work with. (While your still sniggering, keep in mind that .mov has a lot in common with MPEG4.) Whenever I need to write a binary serialization format, I usually copy .mov's tree of structs format, it's ridiculously fast, extensible, and keeps people away from C++ terrible stream operators/Java's BinaryReaderWhateverFactoryErrorProneOneIntAtATimeReader.
- matt4711 14y agodo you have a description of the ".mov tree of structs format"
- breck 14y agoMOV spec: https://developer.apple.com/library/mac/documentation/QuickTime/qtff/qtff.pdf https://developer.apple.com/library/mac/documentation/QuickT...
- daeken 14y agoSimple version (in pseudo-C): struct Atom { uint32 length; uchar type[4]; uchar data[length - 8]; }; The file is a single atom that has other atoms (and random parameters and such) in its data field. You end up with a big tree of atoms which can be parsed as needed. Super simple format -- like the parent, I use atom trees all the time for serialization.
- jacobolus 14y agoFurther points: 1) The specs are now much more publicly accessible than they used to be, and frankly the spec does a fairly reasonable job describing a tricky format relatively compactly. It requires a fair bit of knowledge of Photoshop to read and understand, but it’s mostly fairly explicit. Much better than many other proprietary document formats. 2) For someone with relatively extensive knowledge of photoshop, the format is fairly comprehensible, albeit complicated. The biggest part of the problem here is, as you say, that Photoshop just has a ton of features to support, so that becoming enough of a Photoshop expert to understand it all is a difficult undertaking by itself. 3) The code this comment is taken from only interacts with a small fraction of PSD features, and is frankly pretty awful code: hacky, ad-hoc, not modular at all, etc. All that said, if someone was to redesign PSD format today, I’m sure it would be organized quite a bit differently, and would have much better re-use of a smaller number of features. (The same goes for Photoshop itself.)
- sabret00the 14y agoSo just out of curiosity, why doesn't Adobe embark on those two projects? We're entering a new era of desktop software, surely that should be a catalyst for redesigning both from scratch?
- worldsayshi 14y agoAnd cut all backwards compatibility in doing so? Risky move indeed. Not so sure the benefits would make up for it.
- mistercow 14y agoNo, it wouldn't cut backwards compatibility at all. They have made plenty of additions to the format over the years, and they give you the option of saving to be compatible with previous versions. They could just keep doing that.
- kalleboo 14y ago> They could just keep doing that Then it wouldn't be a new, "clean" format. Then it'd be the old format with additions. Which it already is. Your post makes no sense to me.
- yason 14y agoIf a wise programmer decided he needs a serialization format, would he deliberately include in that format all the crap so vividly pointed to by the article? No. He will think of the "serialization format" as an interchange format between two different instances of his program. One process first writes the data file and another process later will read it. He also knows that sooner or later the "serialization format" needs to talk with different versions of his program, not just different running instances. AFAIK, the Word .doc also started (and unfortunately continued) as basically a not-so-designed memory dump of the in-memory OLE data model. It's a format that more often than not has infamously stumped its own implementation as well. (Over time, OpenOffice has saved quite a lot of .doc files of Office users.)
- taejo 14y agoWord dates back to 1983, while OLE was only introduced in 1990 (but otherwise I think you are correct)
- yuhong 14y agoOffice 97 dates back to 1996.
- Maakuth 14y agoIt could be possible that the format was first very reasonable, but the surrounding platform has changed completely during the development. Then the new layers of specification have been added in a form that seemed to be the best possible solution on that platform and on that time. Wasn't Photoshop at the beginning an app for the original m68k Macintosh? Surely different kind of field sizes made more sense in that world than ours - also the tradeoffs in the sake of performance could have had some say.
- lifeisstillgood 14y agoThe overriding aim of most formats was to load into memeory efficiently - fast load times was the key winner in the 80s and 90s. So you did not want a simple serialisation because that meant slow CPU intensive save and loads. But if you slammed it in pretty much as it would be in memeory you would win. Downside is if you change the in memeory representation of the running program you had to change the file format. And .mov would have no such concerns - it's prime use case is store data in serialised chunks anyway - it was already serialised so could use very dumb stores.
- huhtenberg 14y agoWhen a file uses both little-endian and big-endian serialization, at times within the same logical structure, employs several different ways to store an array, and does other things of similar nature, then it is a genuine clusterfuck regardless of whether it is reflective of "Photoshop particular editing model."
- Camillo 14y ago> I am thereby having a difficult time fathoming why anyone would think that a PSD file is thereby going to be some well-organized file format that they should easily be able to parse from their own application is just naively wishful thinking I like how you embodied your point in the unsyntax of that very sentence. ;)
- saurik 14y agoTwo hours latereader read what I wrote, and thought "man, this comment's upvotes to correct grammar ratio is remarkably high" (this is after one hour later, when I noticed another serious typo in the first few words that I still had time to edit). If it makes any difference to you: I write most of these comments I make on my iPhone, so I often can't even see the whole horizontal line at once. ;P
- SideburnsOfDoom 14y ago> PSD was never intended to be a data interchange format And that's the basic design flaw - it is a data interchange format despite not being designed as one, and the terrible job that it apparently does at it. The people who wrote it didn't recognise that they were going to be filling that need. There's a lesson in there somewhere.
- TeMPOraL 14y ago> There's a lessen in there somewhere. Greetings. I have arrived from the future to spare mankind more years of pain by stating it clear here that the lesson is not "serialize your data to XML".
- lmm 14y agoNo? It seems to be working up well enough so far for e.g. ODT, or indeed the web. A file format that might need to be read in 20 years seems like one of the few cases where the super-verbose XML style is actually appropriate.
- TeMPOraL 14y agoI'm all for super-verbosity in useful information and flexible structure, but XML is also super-verbose in terms of redundant markup. Compression helps a bit, but it still costs processing power for no real reason. See the good ol' S-expressions vs. XML discussion, recently reincarnated as JSON vs. XML.
- Evbn 14y agoJSON is not where one gos to flee verbosity. It is almost identical to XML, save punctuation.
- SideburnsOfDoom 14y agoHm, interesting. Could you explain why the decision to use (zipped) XML in the current MS Office document formats was a mistake? Those document formats are huge hideous beasts, but that's due to backward compatibility with large feature sets, and I don't think that moving off XML would help. PS: I fixed the typo in "lesson"
- ibotty 14y agoi'm not sure i get your point about the similarity to (early) office data formats. these are very badly supported now. that's a stark contrast to your assertion that psd is backwards and forwards compatible to a very large degree. care to elaborate?
- JoeAltmaier 14y agoUm, they could have had a process for how to extend the format. Even GIF has a definition for how to add new pieces. PSD apparently had a process:play it by the seat of your pants? Now, Word docs are xml format. Pretty extensible.