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 |
%%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 mx y l, x y Lx1 y1 x2 y2 x3 y3 c, x1 y1 x2 y2 x3 y3 Cnum wHXa | Native PS operator x y movetox y linetox1 y1 x2 y2 x3 y3 curvetonum setlinewidthclosepathred green blue setrgbcolor | Description starts a new subpath of the current pathappends a straight line segment to the current pathappends a section of a cubic Bezier curve to the current pathsets the line width parameter in the graphics statecloses the current subpathsets 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 Vx1 y1 x3 y3 y, x1 y1 x3 y3 Yred green blue Xared green blue XAcyan magenta yellow black kcyan magenta yellow black KFfSs[ a b c d tx ty ] llx lly urx uryh w bits ImageType AlphaChannelCountreserved 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 pointsappends 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 pointssetrgbcolor for fillsetrgbcolor for strokesetcmykcolor for fillsetcmykcolor for strokefills the area enclosed by the current path with the current filling color or pattern, leaving it as an open paththe same, but close pathstrokes the area enclosed by the current path with the current filling color or pattern, leaving it as an open paththe same, but close pathdescribes a raster image in Adobe Illustrator |
And there are brand new operators, for example those who deal with text, gradients or layers.
AI operator NnBb(path) modified XGtype ToTOalignment Taa b c d ty ty Tmty ty Tdname Ln[ a b c d tx ty ] llx lly urx uryh w bits ImageType AlphaChannelCountreserved bin-ascii ImageMask XF | Description neither fills nor strokes, leaving it as an open paththe same, but close pathfills and strokes, leaving it as an open paththe same, but close pathimage link operatorbegins a text object. The type argument take on one of the following values: 0 − point text; 1 − area text; 2 − path textends a text object and restores the current transformation matrixsets text alignment both horizontally and verticallysets the text matrix for text along a pathtranslates the text matrix by tx and ty to the beginning of the next line of textsets layer namedescribes 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 ... *Uu ... Uname type nColors Bd ... BDtopLeftCellIndex selectedIndex Pb ... PBMb ... MBvisible preview enabled printingdimmed hasMultiLayerMaskscolorIndex red green blue Lb ... LB | Description begin compound path, end compound pathbegin compound group, end compound groupbegin gradient definition, end gradient definitionbegin palette, end palettebegin mask, end maskbegin 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 %_BsrampSpec rampType %_Br%_Gs%_ | Description gradient color stop descriptiondescription of the gradient rampopens the graph sectionmake 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.