upl@gumby.UUCP (future unix gurus) (05/27/86)
Does anyone out there know the algorithm that packbits uses on MacPaint files ? I have downloaded some Paint files to our HP9836. So far I have been able to strip off the data fork on these files, finished the display program on the HP ... but I just couldnt decode their packbits algo to finish this project. Any sugestions or hints on this algorithm would be mucho appreciated ... upl@gumby.wisc.edu c/o Mike Huynh
kearns@garfield.columbia.edu (Steve Kearns) (06/02/86)
I believe June Byte has an article on unpacking Macpaint files. -steve
peterson@utah-cs.UUCP (John W Peterson) (06/03/86)
Since several have asked, here's the gory details on MacPaint files (This is from an old INFO-MAC posting). ----------------------------------------------------------------------- For those interested, here is a description of the format of MACpaint files. This format is the common interchange format for full-page bitmap images on the MACintosh. The first 512 bytes of the file are the header. The first four bytes comprise the version number, followed by 38*8 = 304 bytes of patterns. The remaining 204 bytes of the header are reserved for future expansion. If the version number is zero, the patterns are ignored. Hence, programs that wish to create files to be read into MACpaint can just write out 512 bytes of zero as the header. Following the header are 720 compressed scanlines of data which form the 576 wide by 720 tall bitmap. The bitmap is compressed as follows ; Any run of three or more equal bytes is compressed into a count byte and a single data byte. Runs of unequal bytes are passed on literally, preceded also by a count byte. I.E. <count byte> <data byte> count = -1..-127 --> replicate byte 2..128 times <count byte> <n data bytes> count = 0.. 127 --> copy 1..128 bytes uncompressed count = -128 ignored for backward compatibility That's it. A nice simple scheme. Thanks to Bill Atkinson for providing this info.