FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Tools
(Moderator: REAS)
   Adobe Illustrator format
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Adobe Illustrator format  (Read 554 times)
amoeba

WWW
Adobe Illustrator format
« on: Jan 6th, 2004, 8:33pm »

[Just cross-posting this from the General forum, since it has a Tools-ish bent and maybe someone wants to actually do something with this information... m]
 
The Adobe Illustrator format is actually not that complex, mostly it's a less verbose version of Postscript with added functionality. It is described in this PDF document:  
Adobe Illustrator File Format Specification.  
 
Note that this is the AI 7.0 format, I usually save files as AI 3.0 files if I want to extract data. In Illustrator CS, this is only possible through using Export -> Illustrator Legacy.
 
If all you want to do is extract curves, you can do the following while reading the file:
 
1. Skip lines until to the line that says "%%EndSetup".
 
2. When you find a line that matches "x y m" (x and y being numbers, start a new path with the current point defined by the coordinates given.
 
3. "x y [l/L]" means lineto. Add a line from the current point to the new point.
 
4. "x y x y x y [c/C]" is a curveto. Add a curve segment using the current point as the starting  
point, then complete it using the three points given.
 
5. n/N/s/S/f/F/b/B operators on a single line mean that the path is complete. Some of these specify that the path should be closed (connected to the first point), others that it remain open.
 
Illustrator has two special operators y/Y and v/V for specifying curves with corners or smooth points, but just looking for the c/C operator will give you most bezier curves in a document.
 
Hope this makes sense. I've meaning to make a proper library for import for years now, which means I probably never will. Oh well. Look forward to seeing someone else's efforts
 

marius watz // amoeba
http://processing.unlekker.net/
Koenie

170825270170825270koeniedesign WWW Email
Re: Adobe Illustrator format
« Reply #1 on: Jan 6th, 2004, 8:40pm »

Maybe it would be cool to make it the other way around. Instead of reading from a AI file, writing to an AI file.... working on that
 
Koenie
 

http://koeniedesign.com
amoeba

WWW
Re: Adobe Illustrator format
« Reply #2 on: Jan 7th, 2004, 5:14pm »

Writing to Postscript is easier than writing to Illustrator format, since you don't have to worry about correct headers. All the major Adobe applications read Postscript pretty well these days.
 
I've just put a simple library that I call SimplePostscript online. It allows you to output Postscript from inside Processing, you just download the .class file and put it in the "code" folder of your sketch.
 
Hope this is useful.
 

marius watz // amoeba
http://processing.unlekker.net/
Pages: 1 

« Previous topic | Next topic »