Can I get path information out of Photoshop / Illustrator?
July 4, 2007 3:15 PM Subscribe
Bezier Curves: Is there a way I can access the information about a path in Photoshop or illustrator (x,y positions of anchors and control points).
I'd like to be able to draw a shape path in photoshop and then use that information as input in a language like Processing or Flash that have functions that take positions of anchor points and handles. For instance, the bezier function in Processing looks like this: bezier(x1, y1, cx1, cy1, cx2, cy2, x2, y2).
Or is there an easier way that I'm just totally missing? I just find it very dificult to make the shapes by inputing numbers and trying to get the shapes right.
I'd like to be able to draw a shape path in photoshop and then use that information as input in a language like Processing or Flash that have functions that take positions of anchor points and handles. For instance, the bezier function in Processing looks like this: bezier(x1, y1, cx1, cy1, cx2, cy2, x2, y2).
Or is there an easier way that I'm just totally missing? I just find it very dificult to make the shapes by inputing numbers and trying to get the shapes right.
That is, from Illustrator. But what about cutting and pasting directly from Illustrator to Flash?
posted by b33j at 3:57 PM on July 4, 2007
posted by b33j at 3:57 PM on July 4, 2007
Best answer: Processing can use the Candy SVG library to import & display shapes saved in SVG format, so you really just need to get illustrator to export SVG files.
I use InkScape to edit SVG files directly. It's open-source, so you might want to give it a try.
posted by Crosius at 4:31 PM on July 4, 2007
I use InkScape to edit SVG files directly. It's open-source, so you might want to give it a try.
posted by Crosius at 4:31 PM on July 4, 2007
Response by poster: Crosius: Excellent. It appears that I can also get the information referencing the DOM with JavaScript, so now I have two routes to pursue. Your lead looks simpler though.
posted by miniape at 6:16 PM on July 4, 2007
posted by miniape at 6:16 PM on July 4, 2007
Well, if you already know how to program Flash, you can program Photoshop and Illustrator in virtually the same language. Flash is programmable in Actionscript while PS and AI are programmable in Javascript. Both languages are based on ECMA-script.
You could (I think -- I've never actually programmed PS) write a PS script that reads the vector points and outputs them. Then you could enter those values into Flash or Processing.
You could also cut out PS/AI and do the whole thing in Flash. I can think of two ways of doing this:
1) You could use Javascript For Flash (Flash's application-scripting language) to read x-y positions of bezier curves you've drawn with Flash's pen tool. Then you could use Actionscript to redraw these points using code.
2) You could roll your own pen-tool by coding it in Actionscript. This would be fairly easy using AS's drawing commands. Since it would be your program from start-to-finish, you'd have instant access to the point info.
Oh, one more idea. SVG is a form of XML, right? Actionscript can parse XML. So output from AI in SVG and write an Actionscript program to read in the XML and use the info to redraw the curves.
posted by grumblebee at 6:20 PM on July 4, 2007
You could (I think -- I've never actually programmed PS) write a PS script that reads the vector points and outputs them. Then you could enter those values into Flash or Processing.
You could also cut out PS/AI and do the whole thing in Flash. I can think of two ways of doing this:
1) You could use Javascript For Flash (Flash's application-scripting language) to read x-y positions of bezier curves you've drawn with Flash's pen tool. Then you could use Actionscript to redraw these points using code.
2) You could roll your own pen-tool by coding it in Actionscript. This would be fairly easy using AS's drawing commands. Since it would be your program from start-to-finish, you'd have instant access to the point info.
Oh, one more idea. SVG is a form of XML, right? Actionscript can parse XML. So output from AI in SVG and write an Actionscript program to read in the XML and use the info to redraw the curves.
posted by grumblebee at 6:20 PM on July 4, 2007
This thread is closed to new comments.
posted by b33j at 3:57 PM on July 4, 2007