Adobe Illustrator File Format Summary

Also Known As: AI, Adobe AI


Type Metafile
Colors Unlimited
Compression None
Maximum Image Size NA
Multiple Images Per File Yes
Numerical Format ASCII
Originator Adobe
Platform Macintosh, MS Windows, NeXT
Supporting Applications Adobe Illustrator, most desktop publishing packages, most drawing packages, Adobe Streamline
See Also CGM

Usage
Storage and interchange of line-based artwork.

Comments
A widely used format for the exchange of 2D objects. Basic files are simple to write. Unfortunately, files created by applications implementing the full AI specification can be large and complex and may be slow to render.

Vendor specifications are available for this format.


Originally written for the Macintosh platform, Adobe Illustrator is a well-known and widely used drawing application. There are currently Macintosh, Microsoft Windows, and NeXT versions. Much of the power of Adobe Illustrator comes from its implementation of Bezier splines as drawing objects, and the fact that it presents a simple user interface for precise positioning of spline-based drawing objects. Bezier splines have some advantages for the modeling of natural (and some human-made) objects. AI files are also used to distribute clip art.

Contents:
File Organization
File Details
For Further Information

The AI format encapsulates and formalizes a subset of the PostScript page description language (PDL) in a structured file. Such files are meant to be imaged on a PostScript printer, but may include a bitmap version of the image to facilitate screen preview. PostScript is a powerful and complex language in its full implementation, and this complexity is partly due to its ability to specify almost anything that can appear on a 2D output device. AI, however, is tailored to the storage of graphics data in the conventional sense: drawings, artwork, and lettering used for ornamental and display purposes. Note that AI files can still be quite complex. PostScript derives much of its power from the ability to define sequences of operations and to later concatenate them using a simple syntax. This hidden complexity is sometimes, but not always, minimized in AI files.

Simple AI files are quite easy to construct, and an application can create files that can be read by any AI reader or can be printed on any PostScript printer. Reading AI files is another matter entirely. Certain operations may be difficult for a rendering application to implement or simulate. In light of this, developers often choose not to render the image from the PostScript-subset line data in the file. Note, however, that almost all of the image can usually be reconstructed using simple operations. If you wish to develop an AI reader, it can be done, and you can get hints by examining the source code of the GNU GhostScript system, which provides a nearly full implementation of the PostScript language.

PostScript, and consequently the AI subset, has its own language and conventions. We suggest that you read the PostScript documents prior to working with AI files or perusing the specification document included on the CD-ROM. These are referenced at the end of this article.

File Organization

AI files consist of a series of ASCII lines, which may be comments, data, commands, or combinations of commands and data. Commands in AI files are operators, which may or may not be followed by data. Data is pushed and popped off a stack, and operators use data on the stack in LIFO order. PostScript is sometimes thought of as a stream-oriented PDL. Lines, however, must be parsed first as full lines and then tokenized. Operator lines usually have the following form:

arg-list operator

Key concepts are path, stroke, fill, and the graphics state. A path is traveled by a graphics cursor. Stroking results in a path or portion of a path eventually being displayed on the rendering surface. Fills operate on closed paths. The results of stroking and what actually happens during a fill operation (among other things) are determined by the graphics state.

Comments are any line where the first non-whitespace character is %. Special lines, known as structuring comments, are designated by the double-comment %%. A + immediately after a structuring comment designator indicates that the data on the line is associated with the previous structuring comment.

In the discussion that follows, llx, lly, urx, and ury refer to lower-left x, lower-left y, upper-right x, and upper-right y, respectively. These are used to denote bounding box rectangles and are similar to how rectangles were specified in the original Macintosh development environment. This can cause problems in other systems because many objects are oriented relative to their bounding boxes. Developers in other environments should consider themselves forewarned.

AI files are organized as follows: a file ID line, followed by a header, followed by the rest of the file in which the graphics objects are defined. In Adobe terminology, the header consists of structuring and other comments known as the Prolog. Following the header is a Script Setup section, which consists of the drawing commands defining the objects in the image, a section called the Page Trailer, and a section called the Document Trailer. Files are terminated with the structuring comment %%EOF, signaling to the rendering application or device that the data associated with the image to be rendered is complete.

ID line

Prolog

Comments

Script Setup

Objects

Page Trailer

Document Trailer

File Details

All AI files start with a comment line in the following format:

%!PS-Adobe-X.X EPSF-Y.Y

where X.X and Y.Y are the AI and EPSF (format or the encapsulated bitmap), respectively. Remember that your reader must examine and tokenize the first line, whether or not it is a comment, in order to identify the file.

This is followed by a series of structuring and other Adobe-defined comments and a host of procedure sets that make up the header.

%File ID line
%%BeginProlog
   .
   . list of header comments
   .
%%EndComments
   .
   . list of procedure set definitions
   .
%%EndProlog

A typical header appears as follows:

%%BeginProlog
%%Creator: Adobe Illustrator 4.0
%%For: John Doe Xylane University
%%Title: Figure 1.1
%%CreationDate: 12-13-95 03:43:15
%%BoundingBox: 0 0 512 512
%%EndComments
%%DocumentSuppliedResources: procset AdobeCustomColor Red123 3 0
%%EndProlog

Note that Adobe Illustrator can save files locally in a "no-header" version, in which case much of this information--except for the file ID line and the BoundingBox comment--will be absent. Files saved by Adobe Illustrator for export will generally contain more extensive header information. Adobe advises that a document in the following format is the mimimum acceptable for reading by Adobe Illustrator:

%!PS-Adobe-3.0
%%BoundingBox llx lly urx ury
%%EndComments
%%EndProlog
%%BeginSetup
   .
   . font encoding
   .
   .
   . pattern definitions
   .
%%EndSetup
   .
   . object definition
   .
%%Trailer
%%EOF

Structuring Comments

Some structuring comments are used only in the header. Others appear later in the file.

The Microsoft Windows version of Adobe Illustrator (v4.0) uses the following structuring comments:

%%Creator: Adobe Illustrator(TM) version
%%For: user, organization
%%Title: title
%%CreationDate: date, time
%%DocumentProcSets: Adobe_Illustrator_version level revision
%%DocumentSuppliedProcsets: Adobe_Illustrator_version level revision
%%DocumentFonts: fonts
%%BoundingBox: llx lly urx ury
%%TemplateBox: llx lly urx ury
%%Template: filename
%%PageOrigin: x y
%%PrinterName: printer
%%PrinterRect: llx lly urx ury

These last four comments are normally stored in the resource fork in the Macintosh environment.

The following are comments used in the header. Most are optional, and some are Macintosh-specific and are ignored on other platforms.

%%BeginProlog
%%BoundingBox: llx lly urx ury Integers
%%CMYKCustomColors: custom-color-name
%%CreationDate: date time Valid PostScript strings
%%Creator: name version Program used to create file
%%DocumentCustomColors: custom-color Color defined in file
%%DocumentFiles: file-to-import
%%DocumentFonts: font-name Font used in image
%%DocumentNeededResources: other-resourcesNeeded to reconstruct image
%%DocumentProcessColors: colorsColors in color model definition
%%EndComments
%%EndProlog
%%EOF
%%For: name Optional info
%%IncludeResource: name Misc necessary to reconstruct image
%%Title: name Name of image

Procedure Sets

Procedure set definitions start with the DocumentSuppliedResources keyword, and are followed by the keyword procset and a list of arguments consisting of one or more of the following:

Adobe_cmykcolor
Adobe_cshow
Adobe_customcolor
Adobe_Illustrator_AI3
Adobe_packedarray
Adobe_pattern_AI3
Adobe_typography_AI3

These are followed by the version and revision numbers, as shown in the following example:

DocumentSuppliedResources: procset Adobe_cshow 3 4

This is the case for all but Adobe_customcolor, which adds the color name and has the following syntax:

DocumentSuppliedResources: procset Adobe_customcolor Red123 3 4

Note that among the structuring comments, only BoundingBox must be included in every AI file and helps denote the size and scale of the image.

Header Comments

The following header comments may be optionally included between the BeginProlog and EndProlog statements in the header, at the end of the rest of the header comments.

%AI3_ColorUsage: Black&White or Color
%AI3_TemplateBox: llx lly urx ury
%AI3_TemplateFile: vol::dir id:name
%AI3_TileBox: llx lly urx ury Mac-specific

Script Setup Section

The Script Setup section of the file consists of setup information, a list of object definitions, and the page and document trailers.

The setup portion of this section has the following format:

%%BeginSetup
%%IncludeFont: font
   .
   . procedure set initialization
   .
   .
   . font encoding
   .
   .
   . pattern definitions
   .
%%EndSetup

The font specified on the IncludeFont line is one used in the document and should be substituted for if the correct font is unavailable to the rendering application. Procedure sets defined in the prolog often need to be initialized and are deinitialized (or terminated) later in the file. Font encoding is the process of mapping ASCII codes to glyphs found in the font file. We won't attempt to explain font encoding here, and instead we refer you to the PostScript references at the end of this article. Note, however, that the TE and TZ operators are used to specify font encoding in this section of the file.

Patterns are also defined in this section and are meant to be used one or more times in the file. Pattern definitions have the following syntax:

%%BeginPattern:
pattern-name llx lly urx ury layer-list E
%%EndPattern

Patterns are actually miniature drawings and can have the full complexity of full-sized, multi-layered images. For this reason we refer you to the format specification for further information.

Following the setup portion of the Script Setup section is the script body, consisting of object definitions. These generally form the bulk of the file and can often be parsed and rendered to give a good approximation of the image, particularly in files produced by applications other than Adobe Illustrator.

Preceding each object is a flag, denoted by flag A. If A is set, then the object is considered locked (non-editable) in Adobe Illustrator. Objects may be one of the following:

path placed art
path mask subscriber
composite graph
text PostScript document

In the discussion below, we only describe path objects, placed art objects, subscriber objects, and graph objects in detail. Please consult the AI format document and PostScript specification for further information on composite and text objects. Note that the graph terminology in particular only makes sense with a copy of the Adobe Illustrator application documentation in hand.

Path objects are defined by specifying paint style, path geometry, and path render.

Path paint style is specified by setting the current graphics state. Note that the graphics state can be saved temporarily and restored. The most important of the state arguments are the following:

Argument

Operator

Meaning

array phase

d

Sets dash pattern using array

flatness

i

Bezier path flattening (0-100)

flag

D

Winding order (0=clockwise)

linecap

J

0=butted, 1=round, 2=square

linejoin

j

0=mitered, 1=round, 2=beveled

linewidth

w

Width of line (minimum 0)

miterlimit

M

Adjusts mitering (>1)

Path geometry is specified using the following syntax:

Argument

Operator

Meaning

x y

m

moveto

x y

l

lineto

x y

L

lineto corner

x1 y1 x2 y2 x3 y3

c

curveto--append Bezier to path

x1 y1 x2 y2 x3 y3

C

curveto corner

x2 y2 x3 y3

v

Insert Bezier starting with current point

x2 y2 x3 y3

V

Insert Bezier to corner

x1 y1 x3 y3

y

Append Bezier to current and finish with x3,y3

x1 y1 x3 y3

Y

Append Bezier to current to corner

Paths can be rendered using the following operators:

Argument

Operator

Meaning

NA

N

Leaves unclosed, unfilled, unstroked path

NA

n

Leaves closed, unfilled, unstroked path

NA

F

Fills path, leaving it unclosed

NA

f

Fills path, closing it

NA

S

Strokes path with current default values

NA

s

Closes path and strokes with current defaults

NA

B

Leaves unclosed, but fills and strokes path

NA

b

Leaves closed, filled, stroked path

Placed art objects are EPS files included in an AI file. They can be included either by reference (to an external file) or inline. Both types of included files begin with the single-quote (') operator and end with a tilde (~) operator. Between these is the %%IncludeFile: comment for externally referenced files, or a %%BeginDocument and %%EndDocument pair for inline files. The ' operator has the following syntax:

a b c d tx ty llx lly urx ury filename '

Arguments a, b, c, d, tx, and ty are optional and specify the transformation matrix for the file to be included. Arguments llx, lly, urx, and ury specify the bounding box of the included file. Argument filename is the full pathname of the included file.

Externally referenced files:

a b c d tx ty llx lly urx ury filename '
%%IncludeFile: filename
~

Inline files:

a b c d tx ty llx lly urx ury filename '
%%BeginDocument: filename
.
. included file contents
.
%%EndDocument
~

Macintosh systems may include references to subscriber objects, associated with the the publish and subscribe feature available in System 7. These are indicated by the %%subscriber comment:

%AI3_Subscriber: res-number
placed art object

where res-number is the resource number of the SECT resource in the file, and the placed art object is as described above.

Graph objects are used to specify graphs for business, technical, and scientific purposes. A number of commands allow full control over labeled illustrations, including the placement and appearance of the following (Adobe-defined) parts. Many details of these commands make sense only in the Adobe Illustrator environment:

axes legend group
label group data column
axis tick series 0
category axis group series 1
edge

Argument

Operator

Meaning

NA

Gs

Start of graph object

NA

GS

End of graph object

l t r b

Gb

Graph bound (left,top,right,bottom)

(see spec)

Gy

Values in Graph Style dialog box

(see spec)

Gd

Values in Graph Style dialog box

axis string

Ga

Axis: 1=bottom, 2=left, 3=right

(see spec)

GA

Axis specs

r c fr fc

Gz

Cell table: rows, columns, first row, first column

cv1, cv2...cvx

Gc

Reads cell values 1-x into table

cw1, cw2...cwx num

Gw

Column widths 1-x, num=number of columns

NA

GC

Cell table is complete

NA

Gt

Start graph customizations

NA

GT

End graph customizations

target cust

Gx

Target, customization (see below)

cust

Gp

General Illustrator customization (see below)

method

G+

Change method: 0=reset to new, 1=add new to previous

direction

G1

0=send to back, 1=send to front

df ds fcs scs m

Gf

doFill, doStroke, fillStyle, strokeStyle, isAMask (see below)

column

Gl

Column index for table

row

Gr

Row index for table

axis

Gi

Which axis object is inside: 1=bottom, 2=left, 4=right, 8=top

(see below)

Gm

Matrix customizations

(see below)

GD

Bar design customizations

repeat

Ge

Repeat bar design

tickvalue

Gv

Numeric value corresponding to customized tick mark

NA

GX

End of customization

target col row axis

Go

Type of graph object just read in (see below)

Gx graph customizations hold information about current defaults. The target parameter is one of the following:

0

Entire graph

1

All series and legend marks

2

One series and legend marks

3

One series but no legend

4

One data bar, line, or wedge

5

All data marks

6

One series and legend marks

7

One series but no legend marks

8

One data line segment's marks

9

One axis, complete

10

Category axis main line

11

One axis major tick mark

12

One axis single major tick mark

13

One axis set of tick labels

14

One axis single tick label

15

All legend text

16

One legend text

17

One numerical axis main line

18

One legend's box or line but no mark

19

One legend's mark

20

All labels along one category axis

21

One label of category axis

22

Entire shadow event

23

Every tick of one axis

24

All minor ticks one axis

25

One minor tick one axis

The customization argument is one of the following:

0

Illustrator Customization

1

Set Series Graph Style

2

Set Column (Bar) Design

3

Set Mark Design

Gp customizations may be one of the following:

0

Move/Shear/Rotate/Scale

1

Set Paint Style

9

Send to Front/Back

11

Set Layout Style

The Gf operator allows the setting of Set Paint Style customization. The doFill, doStroke, and isAMask operators are flags. Operators fillStyle and strokeStyle may be:

0

Black (or white)

1

Process

2

Pattern

3

Custom color

4

Blend (AI for Windows v4.0)

The Gm operator specifies matrix customizations. Arguments are in the form:

a b c d h v generalGraphType reserved1 reserved2

where a, b, c, d, h, and v are matrix values. Argument generalGraphType specifies the type of graph to apply the customization to:

1

Grouped-column and stacked-column

2

Scatter and line graphs

3

Pie charts

4

Area graphs

5

All graphs

Arguments reserved1 and reserved2 are set to 0.

The GD operator has the following form:

designName designType repeatPartialType rotateLegend GD

where designName is a name (string), and designType can be:

6

Vertically scaled design

7

Uniformly scaled design

8

Repeating design

9

Sliding design

Argument rotateLegend is a flag that when set indicates the legend in the design box is rotated. Argument repeatPartialType can be:

16

Chop partial values

17

Scale partial values

The target argument that is associated with operator Go can have the following values:

1

All series with legends

2

One series, including legends

4

One data bar, line, or wedge

5

All data marks

6

One series and its legend marks

8

One data line segment's marks

9

One axis, including text, ticks, line

10

Category axis main line

15

All legend text

20

All labels along category axis

22

Entire shadow object

Script Trailer

The Script Trailer has the following syntax:

%%Trailer
   .
   . procedure set termination
   .

The procedure set terminations section consists of an explicit list of procedure set termination commands, in the reverse order from those specified in the script setup section. An example of a procedure set termination is as follows:

Adobe_customcolor /terminate get exec

For Further Information

Much of the information for this article came from the following document:

Adobe Illustrator File Format Specification, Adobe Developer Support Version 3.0 (Draft), 28 October 1992.

The specification is included on the CD-ROM. This is described as a draft, even though it has been relatively stable since 1989.

You may also contact Adobe at the following address:

Adobe Systems
Developer Support
1585 Charleston Rd.
P.O. Box 7900
Mountain View CA 94039-7900
Voice: 415-961-4400
Voice: 800-344-8335
FAX: 415-961-3769

Adobe also provides a great deal of information online, and is to be congratulated for their willingness to aid developers:

http://www.adobe.com/
ftp://ftp.adobe.com/

Adobe's PostScript documentation is widely available, and is required reading for anyone working with AI files, and is a model of coherence and lucidity; it was published in a set of books in conjunction with Addison-Wesley. Among the books are a tutorial on PostScript programming and the Type 1 font specification. They are available at most computer bookstores. The most important document for understanding the AI format is:

PostScript Language Reference Manual, second edition, Addison-Wesley, Reading, MA. (ISBN 0-201-18127-4)


This page is taken from the Encyclopedia of Graphics File Formats and is licensed by O'Reilly under the Creative Common/Attribution license.

More Resources