What is AI file? | Knowledge Base

Introduction

AI files are files created and used by Adobe Illustrator graphics editor. They are written in PostScript language, which you can read about in the article “What is PS file?”. Remind that PostScript language syntax has postfix notation in Backus−Naur form (BNF).

operand1...operandm operator

Also as you can remember PS files minimally have a structure, consisting of Prolog and Script parts.

%!PS-Adobe-3.0 EPSF
<header comments>
%%EndComments
%%BeginProlog
{<proc set>}         (not required, but is normally present)
%%EndProlog
<setup>
{<layer>}|{<object>}
{<page trailer>}
<document trailer>
%%EOF

Prolog is a part where necessary data for subsequent script, rendering and printing is defined. This data can include the version of Postscript language, bounding box, creator, creation date and title. Necessary fonts, global variables and procedures are also should be defined here. Procedures are combined in procsets, dictionaries where every procedure is connected to the literal name. And every procsets also has a name. In case of EPS file when necessary font or other resource is not defined in Prolog it should be at least noted with corresponding comments %%DocumentNeededFonts, %%DocumentNeededResources, %%DocumentNeededProcSets, %%DocumentNeededFiles. Script contains page graphics descriptions that use procedures, global variables and fonts defined earlier in Prolog. Structure of PS/EPS files is marked by special structural comments, lines that begin with %%.

What is AI file?

AI file or abbreviated Adobe Illustrator file is actually EPS file, as it is claimed by Adobe in AI specification. It contains two comments that are required in EPS files:

%!PS-Adobe-3.0 EPSF

and

%%BoundingBox: ...

Differences between AI and EPS files.

The main difference is operators. Adobe Illustrator operators are one or two-symbols sequences, while PS/EPS use human-readable keywords that contain usually more than 2 letters.

Adobe Illustrator uses more than 130 such 1-2-letter operators and definitions of them are not stored in Prolog of AI file, as It would be in the case of EPS file, but are stored somewhere in Adobe Illustrator application. Very likely they are loaded in memory when the application starts. And this is the second main difference between EPS and AI files.

Thus, AI files can be treated as EPS files only in case when Adobe Illustrator is used for creating, editing, viewing, and printing them. For external consumers, who do not have access to licensed stuff of Adobe Illustrator not included in Prolog of AI file, that is AI operators definitions, procedure sets, fonts, etc., AI format should be considered as a separate brand new file format.

Some AI operators are just short forms of PS operators, as is shown below.

AI operator

x y m
x y l, x y L
x1 y1 x2 y2 x3 y3 c, x1 y1 x2 y2 x3 y3 C
num w
H
Xa

Native PS operator

x y moveto
x y lineto
x1 y1 x2 y2 x3 y3 curveto
num setlinewidth
closepath
red green blue setrgbcolor

Description

starts a new subpath of the current path
appends a straight line segment to the current path
appends a section of a cubic Bezier curve to the current path
sets the line width parameter in the graphics state
closes the current subpath
sets the current color space in the graphics state to DeviceRGB and the current color to the component values specified by red, green, and blue

Others represent a more detailed form of PS operators.

AI operator

x2 y2 x3 y3 v, x2 y2 x3 y3 V
x1 y1 x3 y3 y, x1 y1 x3 y3 Y
red green blue Xa
red green blue XA
cyan magenta yellow black k
cyan magenta yellow black K
F
f
S
s
[ a b c d tx ty ] llx lly urx ury
h w bits ImageType AlphaChannelCount
reserved bin-ascii ImageMask
XI

Description

adds a Bezier curve segment to the current path between the current point and the point x3, y3, using the current point and then x2, y2 as the Bezier direction points
appends a Bezier curve to the current path between the current point and the point x3, y3 using x1, y1 and x3, y3 as the Bezier direction points
setrgbcolor for fill
setrgbcolor for stroke
setcmykcolor for fill
setcmykcolor for stroke
fills the area enclosed by the current path with the current filling color or pattern, leaving it as an open path
the same, but close path
strokes the area enclosed by the current path with the current filling color or pattern, leaving it as an open path
the same, but close path
describes a raster image in Adobe Illustrator

And there are brand new operators, for example those who deal with text, gradients or layers.

AI operator

N
n
B
b
(path) modified XG
type To
TO
alignment Ta
a b c d ty ty Tm
ty ty Td
name Ln
[ a b c d tx ty ] llx lly urx ury
h w bits ImageType AlphaChannelCount
reserved bin-ascii ImageMask
XF

Description

neither fills nor strokes, leaving it as an open path
the same, but close path
fills and strokes, leaving it as an open path
the same, but close path
image link operator
begins a text object. The type argument take on one of the following values: 0 − point text; 1 − area text; 2 − path text
ends a text object and restores the current transformation matrix
sets text alignment both horizontally and vertically
sets the text matrix for text along a path
translates the text matrix by tx and ty to the beginning of the next line of text
sets layer name
describes a raster image in Adobe Illustrator when the actual image data is not included in the file

It is worth mentioning especially grouping operators. They are composed from begin and end operators and have other operators between them.

AI operator

*u ... *U
u ... U
name type nColors Bd ... BD
topLeftCellIndex selectedIndex Pb ... PB
Mb ... MB
visible preview enabled printing
dimmed hasMultiLayerMasks
colorIndex red green blue
Lb ... LB

Description

begin compound path, end compound path
begin compound group, end compound group
begin gradient definition, end gradient definition
begin palette, end palette
begin mask, end mask
begin layer definition, end layer definition

The third difference is pseudo comments. As we already know PostScript interpreter distinguishes standard comments, lines that begin with ‘%’ and structural comments that begin with ‘%%’. Adobe Illustrator adds additional, so-called, “pseudo” comments, that begin with ‘%_’. These comments are actually brand new, peculiar to Adobe Illustrator, operators. They are implemented as comments in order to be ignored by the PostScript interpreter but are used by Adobe Illustrator and other applications that read and parse AI files. Below is an example of such comments-operators.

AI operator

colorSpec colorStyle midPoint rampPoint %_Bs
rampSpec rampType %_Br
%_Gs
%_

Description

gradient color stop description
description of the gradient ramp
opens the graph section
make some other peculiar to Adobe Illustrator operators ignorable by PS interpreter

The last difference between AI and EPS files is Revisable Form. Adobe separates Revisable Form and Final Form of a document. Final Form contains only information necessary for viewing or printing pages. Revisable Form contains other stuff that can be used for editing documents in an application but is not necessary for printing. Some AI operators exist only for Revisable Form. Especially many of these operators are used in working with text. Pseudo comments are all used for Revisable Form. EPS files, in contrast, are documents in Final Form.

What is AI File used for?

AI file is used for editing, transferring and storing Adobe Illustrator application graphics.

How do I open an AI File?

AI files can be opened and viewed with standalone Adobe Illustrator application. You can also use AI Viewer from Aspose to open ypur document. It is a cross-platform app that does not require installation.

Is PDF the same as AI File?

No, they are different formats and languages. Though PDF and AI files have the same internal page description model, PDF is a static Page Description Language, while AI is a subset of PostScript, dynamic Page Description Language.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.