• Hello MLAers! We've re-enabled auto-approval for accounts. If you are still waiting on account approval, please check this thread for more information.

PICT Data Format

jmacz

68020
I was looking through the system ROM for a PowerBook Duo 280c as part of looking into a strange icon using my duo dock. I saw what looked to be images in the ROM so I extracted out that data for 13 images and wrote a quick program that would render the images as ASCII. Here's an example of one of images outputted using the program.

Screenshot 2025-03-20 at 6.17.42 PM.png

It's a 28x36 bitmap with a PICT header. But there's around 22 bytes inside the data that I don't quite understand based on documentation I've found describing the PICT format. What I'm seeing:
  • Usual version 1 PICT header at the beginning of the data:
    • File Size (short): 197
    • Top (short): 0
    • Left (short): 0
    • Bottom (short): 36
    • Right (short): 28
    • Version (byte): 0x11
    • Picture version (byte): 0x01
  • This next part I don't quite understand:
    • Three Hex Bytes: 0x01 0x00 0x0a
    • Four Shorts: 0 0 36 28
    • Three Hex Bytes: 0x90 0x00 0x04
    • Four Shorts: 0 0 36 28
    • Four Shorts: 0 0 36 28
    • Four Shorts: 0 0 36 28
    • Two Hex Bytes: 0x00 0x00
  • And then the actual bitmap data begins
    • 36 rows of 4 bytes containing 28 bits of bitmap data + 4 padding bits
The stuff in red is what I don't quite understand. I would have expected the bitmap data to start after the pict header plus maybe a one byte opcode, but wasn't expecting these 22 bytes in which it looks like the bounds (top, left, bottom, right) are repeated 4 times. All the image data I extracted had a similar structure with the only difference being in the second set of three hex bytes.

PICT documentation I have found was confusing. Was wondering if anyone had a pointer to solid documentation.
 
I almost thought I would help but the one particular site I sometimes like to refer myself to seemingly has no actual entry for pict format but somehow does mention it a few times in the eps format page nevertheless

I guess the only real question could be if you have yet managed to check out any archived quickdraw references from apple themselves?
 
This documentation is still on Apple's site and I think it might help explain some of it:

  • The first red 0x01 is an opcode of ClipRgn, then the 0x00 0x0A is a length of 10. Following that is the bounding rect of the region (0, 0, 36, 28). Seems to be confirmed by this example PICT in Apple's docs.
  • Then the next byte is new opcode of 0x90 (BitsRect). This one's a little harder to follow and I'm not an expert but I believe it's the actual opcode for the bitmap data. Apple's docs are confusing here because I think they link to PICT version 2 info for the BitsRect data, but this documentation is a little more useful. It says what follows is rowBytes, bounds, srcRect, dstRect, mode, and finally the unpacked bitData.
    • So: rowBytes is 4, then bounds, srcRect, and dstRect are all the (0, 0, 36, 28) rect, mode is 0, and then the actual data follows. That's my best guess anyway!
 
Thanks @chelseayr @dougg3. Maybe I need to just be more open minded :) The stuff that was confusing me as I was looking at the opcodes was for example the title of the table in that link is

Table A-2Opcodes for extended version 2 and version 2 pictures

so I was thinking it was specific to a v2 PICT (whereas mine is version 1). But I ended up looking at it anyway and as I was looking at the Clip opcode, the additional data just says region size so it was not clear to me that the 0x0a (10) I was seeing was correct as I didn't think to assume it was five shorts (the total size of the additional data including the short for the size + four shorts for the bounding rect).

But this definitely helps me, thanks!!
 
I wonder if there's an older doc somewhere that was written before version 2 existed. Maybe one of the earlier Inside Macintosh volumes? It might be easier to read. I certainly found Apple's docs confusing about what was expected after the ClipRgn opcode!

If you scroll down further on that page, they have a separate table for the version 1 PICTs "Table A-3 Opcodes for version 1 pictures".
 
Aww man, buried down there. I see it now. But yeah, still confusing on the additional data. Thanks for the pointers though!
 
So that was really useful. Appreciate the help @dougg3! I was able to use the more textual doc you linked (which was actually easier to follow) and implement enough opcodes including the run length encoded bits to get what I needed. Alas, the images are cool but not the one I was specifically looking for (the duo dock icon). Will need to continue hunting for that when I have time. But some of the outputs:

arrows.png

battery.png

six.png

decrypt.png
 
Resorcerer can be used to view ROM resources. Use the "Make ROM resources look like an openable file" option in the Preferences. Then select the "System ROM Resources" file from the System Folder. Some resources may be excluded if they are not for your specific Mac model.

My dumpromresources script (previously discussed at https://68kmla.org/bb/index.php?threads/lc475-disassembled-rom.49526/post-557503 ) can be used to list all resources and extract their data. The result can be converted to a resource file using the Rez command.

Resorcerer can view the PICT opcodes of a PICT resource (click the Data button).
DiskMode 3 pict.png
 

Attachments

The DeclData has some icons (but maybe not the duo dock icon you are looking for). The output from my SlotsParse command (included in the zip attached to my previous post) lists some icons but doesn't include their data (requires some minor modification). SlotsDump is a classic app that can get the same data and draws any icons that it finds.
https://github.com/joevt/SlotsDump

If you have a clear enough picture, you could maybe convert it to a bit map, then search for that hex in the rom or system file.
An icon is 32x32. 1 bit per pixel. 4 bytes per line. So you could select a distinctive line of the icon and search for patterns that might match that line.
 
I was looking for icons in the ROM using GraphicConverter 11. Import as raw, 1 bit gray scale. 32 pixels wide. But first you need to split it into 64K chunks so that the height of each image is 16384 pixels.

Code:
therom="1994-04 - 015621D7 - Powerbook Duo 280 & 280c.ROM"
partsize=65536
numparts=$(( $(stat -f "%z" "$therom") / partsize))
for ((thepart=0;thepart<numparts;thepart++)); do
    echo "part$(printf "%02d" $thepart).bin"
    dd if="$therom" of="part$(printf "%02d" $thepart).bin" bs="$partsize" skip="$thepart" count=1 2> /dev/null
done

I saw a lot of arrows pointing to floppy drives of different Macs, but none for the Duo Dock. Then I looked at the Duo Dock DeclData that was referenced at #19

The DeclData has one sRsrcIcon at offset 0x0f6e for "Macintosh Duo Dock" but that's not the icon you're looking for.

There's icons in the unknown sResource types. Maybe the supermario source code has info about these.

All the icons in the Duo Dock DeclData are displayed in the attached BBEdit.app worksheet.
 

Attachments

@joevt @cheesestraws you guys rock as usual!

Resorcerer can be used to view ROM resources. Use the "Make ROM resources look like an openable file" option in the Preferences. Then select the "System ROM Resources" file from the System Folder. Some resources may be excluded if they are not for your specific Mac model.

Didn't even think to look at Resourcerer. Oh well, it was fun looking into PICT format and playing with it :)

My dumpromresources script (previously discussed at https://68kmla.org/bb/index.php?threads/lc475-disassembled-rom.49526/post-557503 ) can be used to list all resources and extract their data. The result can be converted to a resource file using the Rez command.

Ah neat!

If you have a clear enough picture, you could maybe convert it to a bit map, then search for that hex in the rom or system file.
An icon is 32x32. 1 bit per pixel. 4 bytes per line. So you could select a distinctive line of the icon and search for patterns that might match that line.

Good call.

if this is like the other boot icons, it's an ICN# not a PICT, and it's not a resource. Here's the other icons in super mario, for comparison:

Ok.

I saw a lot of arrows pointing to floppy drives of different Macs, but none for the Duo Dock. Then I looked at the Duo Dock DeclData that was referenced at #19

The DeclData has one sRsrcIcon at offset 0x0f6e for "Macintosh Duo Dock" but that's not the icon you're looking for.

There's icons in the unknown sResource types. Maybe the supermario source code has info about these.

All the icons in the Duo Dock DeclData are displayed in the attached BBEdit.app worksheet.

Thanks!
 
Last edited:
Back
Top