ephraim@wang.UUCP (pri=8 Ephraim Vishniac x76659 ms1459) (05/20/86)
Perenially, people ask about the MacPaint document format. Here it is: A MacPaint document is of type PNTG, creator MPNT. Everything of interest is in the data fork. The data fork starts with a 512-byte header, which gives the MacPaint version number and the current patterns. If you're not MacPaint, just make the header all zeroes. The rest of the data fork represents the 8"x10" bit image. At 72dpi, that's 720 scan lines of 576 pixels each. Uncompressed, each scan line would be 72 bytes and the document would be over 50 Kbytes. To save space, each line is compressed using PackBits. If you're writing your own "MacPaint" documents, you can either use PackBits to compress your output data, or you can prefix each scan line with a decimal 71 to indicate that 72 bytes of uncompressed data follow. (This is the lazy man's method.) To compress such a document, just open it from MacPaint and Save it. If you're not clear on any of this, just make yourself some simple paintings and inspect them with FEdit. I found this very useful both for understanding MacPaint and for learning about PackBits.