Adobe Photoshop 2.0 and 2.5 Path Resource Format
Copyright 1991-1993. Adobe Systems, Inc.
Photoshop stores the paths saved with an image in the resource fork of the image file or in the image resource block. This document describes how to interpret and modify those paths.
(1) Photoshop stores its paths as resources of type '8BIM' with IDs in the range 2000 through 2998. Photoshop stores other information using resources of type '8BIM' so it is important to pay attention to the IDs. The name of the resource is the name given to the path when it was saved.
(2) If the file contains a resource of type '8BIM' with an ID of 2999, then this resources contains a Pascal-style string containing the name of the clipping path to use with this image when saving it as an EPS file.
(3) All points used in defining a path are stored as a pair of 32-bit components, vertical component first. The two components are fixed point numbers with 8 bits before the binary point and 24 bits after the binary point. We insist on leaving three guard bits in the points to eliminate most concerns over arithmetic overflow. Hence, the range for each component is 0xF0000000 to 0x0FFFFFFF representing a range of -16 to 16. We include the lower bound but not the upper bound. We use such a limited range because we express the points relative to the image size. The vertical component is given with respect to the image height and the horizontal component is given with respect to the image width. <0,0> represents the top-left corner of the image; <1,1> (<0x01000000,0x01000000>) represents the bottom-right.
(4) The data in a path resource consists of a sequence of 26 byte records.
- A. The first two bytes (bytes 0 and 1) of each record are a 16-bit value
which indicates the kind of data contained in the rest of the record.
- B. If the kind value is 0, 1, or 2, then this record is part of the
description of a closed subpath within the compound path.
- If the kind value is 0, then bytes 2 and 3 of the record contain the length
of the closed subpath. Such a record is then followed by records describing
the knots of the subpath. This must be the first record in the subpath
description.
- If the kind value is 1 or 2, then the remaining 24 bytes of the record
represent three points in the above format giving the control point for the
Bezier segment preceding the knot, the anchor point for the knot, and the
control point for the Bezier segment leaving the knot in that order. If the
kind value is 1, the control points are linked; i.e., editing one point edits
the other one to preserve collinearity. Knots should only be marked as having
linked controls if their control points are collinear with their anchor. If
the kind value is 2, then this is a knot for which the control points are not
linked.
- C. If the kind value is 3, 4, or 5, then this record is part of the
description of an open subpath within the compound path.
- If the kind value is 3, then this is a path length record just like kind
value 0.
- If the kind value is 4, then this record contains the data for a knot with
linked controls on the open subpath.
- If the kind value is 5, then this record contains the data for a knot with
non-linked control on the open subpath.
- D. Further kind values may be added in the future. Since Photoshop will
ignore records for which it does not understand the kind value, this is a
relatively easy format to extend.