Macintosh PICT

Also Known As: PICT, Macintosh Picture, .PCT, QuickDraw Picture Format


Type Metafile
Colors Up to 24-bit
Compression PackBits, JPEG
Maximum Image Size NA
Multiple Images Per File No
Numerical Format Big-endian
Originator Apple Computer, Inc.
Platform Apple Macintosh
Supporting Applications Most Macintosh programs
See Also Macintosh Paint

Usage
Desktop publishing, paint, and imaging applications using QuickDraw calls.

Comments
A versatile format in wide use on the Macintosh by applications having anything to do with graphics. Because of its complexity, however, it is seldom supported on other platforms.

Vendor specifications are available for this format.

Code fragments are available for this format.

Sample images are available for this format.


The Macintosh PICT (Macintosh Picture) format is associated with applications on the Macintosh and is one of the best supported formats on that platform. PICT files are meant to encapsulate the functionality of QuickDraw, the native graphics drawing protocol on the Macintosh, and consist mainly of QuickDraw calls arranged in no particular order. There have been two major releases of QuickDraw, v1.0 and v2.0 (Color QuickDraw). There have also been numerous minor QuickDraw revisions, each associated with a corresponding Macintosh PICT version.

Contents:
File Organization
File Details
For Further Information

QuickDraw v1.0 supports monochrome bitmaps up to 32K in size. Image resolution is fixed at the original Macintosh display resolution, or 72 dpi.

QuickDraw v2.0, sometimes known as Color QuickDraw, supports 8-bit bitmaps as well as monochrome. There is no compression available for 8-bit Version 2.0 PICT files.

All information in Macintosh PICT files is stored in the data fork of the Macintosh file pair. Although the resource fork may be present, it is left empty. Image data is stored in binary format and consists of a series of operators and associated data.

High-level routines in the Macintosh ToolKit are available to read and write PICT files and are often used when writing applications that translate PICT files to other image file formats.

File Organization

All Macintosh PICT files start with a 512-byte header, which contains information that the Macintosh uses to keep track of the file. This is followed by three fields describing the image size (picSize), the image frame (picFrame), and a version number. In v2.0 files, another header follows. In both versions, the preceding information is followed by the image data. In all versions, the end of the file is signalled by an end-of-file operator.

File Details

QuickDraw, and consequently the Macintosh PICT format, is far too complex for us to do justice to it here, so we will merely note some details about the start of the file. A good deal of information and codes are included on the CD-ROM. Note that most secondary references only give examples of bitmap encoding and ignore the vector nature of the format.

The information following the platform-specific 512-byte header is in the following format:

SHORT    File size in bytes
SHORT    Frame x-value of top left of image (at 72 dpi)
SHORT    Frame y-value of top left of image (at 72 dpi)
SHORT    Frame x-value of lower right of image (at 72 dpi)
SHORT    Frame y-value of lower right of image (at 72 dpi)

in v1.0 files, this is followed by:

BYTE     Version operator(0x11)
BYTE     Version number(0x01)
or, in v2.0 files, by:
SHORT    Version operator (0x0011)
SHORT    Version number (0x02ff)

Version 2.0 files also have a 26-byte header following the version information:

SHORT    Header opcode for Version 2 (0C00)
SHORT    FFEF or FFEE
SHORT    Reserved (0000)
LONG     Original horizontal resolution in pixels/inch
LONG     Original vertical resolution in pixels/inch
SHORT    Frame upper left x at original resolution
SHORT    Frame upper left y original resolution
SHORT    Frame lower right x at original resolution
SHORT    Frame lower right y at original resolution
LONG     Reserved

picSize and picFrame records follow the header.

picSize

WORD     Picture size in bytes
WORD     Image top
WORD     Image left
WORD     Image bottom
WORD     Image right

picFrame (PICT v1.0)

BYTE     Version (11h)
BYTE     Picture version (01h)

This is followed by the image data. Each record in a PICT version 1 file consists of a one-byte opcode followed by the actual data.

picFrame (PICT v2.0)

WORD     Version (0011h)
WORD     Picture version (02ffh)
WORD     Reserved header opcode (0c00h)
WORD     Header opcode (0c00h)
DWORD    Picture size (bytes)
DWORD    Original horizontal resolution (pixels/inch)
DWORD    Original vertical resolution (pixels/inch)
WORD     x value of top left of image
WORD     y value of top left of image
WORD     x value of lower right of image
WORD     y value of lower right of image
DWORD    Reserved

This is followed by the image data. Each record of a PICT v2.0 file consists of a two-byte opcode followed by the actual data. Note that opcodes and data must be aligned on 16-byte boundaries, and that certain opcodes in PICT v1.0 and v2.0 files are interpreted differently.

For Further Information

For further information about the Macintosh PICT format, see the documentation and sample code included on the CD-ROM.

Additional information on the Macintosh PICT format may be obtained from Claris Corporation, a software spinoff from Apple, in the form of an update to Apple Technical Note #27. Apple Technical Notes may be obtained from Apple Computer and from many online information services. Contact:

Apple Computer, Inc.
20525 Mariani Avenue
Cupertino, CA 95104
Voice: 408-996-1010
Voice: 800-538-9696
FAX: 408-974-1725
WWW: http://www.apple.com/
Claris Corporation
5201 Patrick Henry Drive
P.O. Box 58168
Santa Clara, CA 95052-8168
Technical Support: 408-727-9054
Customer Relations: 408-727-8227
WWW: http://www.claris.com/

Other Apple Technical Notes related to Macintosh PICT and other Apple formats include:

TN #021 QuickDraw Picture Definitions

TN #041 Offscreen Bitmaps

TN #091 Optimizing of the LaserWriter--Picture Comments

TN #119 Color QuickDraw

TN #120 Offscreen PixMap

TN #171 Things You Wanted to Know About PackBits

TN #181 Every Picture (Comment) Tells Its Story, Don't It?

TN #154 Displaying Large PICT Files

TN #275 32-Bit QuickDraw Version 1.2 Features

Additional information on the PICT format can be found in:

Apple Computer, Inside Macintosh, vols. I, V, and VI, Addison-Wesley, Reading, MA, 1985.

These volumes are also available on the Apple Developer CDs.



Copyright © 1996, 1994 O'Reilly & Associates, Inc. All Rights Reserved.

Hosted by uCoz