Stroep

Just a collection of random works – Mark Knol

Actionscript to vector graphicI like to generate art and objects with Flash/actionscript. Mostly I use a bitmapdata for that and export this as a PNG-24. This works perfect in most cases. But sometimes I wish there was a simple way to export my art to a scalable vector graphic. This would save a lot of data, and I’ll be able to create unlimited large and sharp prints.

I started searching and found some nice-to-know options.

Save as PDF
If you have a PDF-printer installed, you could save the vectors as PDF (drawed with lineTo, curveTo etc). Just right-click on your flashmovie, and choose ‘print..‘. Then choose ‘Adobe PDF‘ or another PDF printer. This is very simple!
Downside; My flash movie is becoming very slow when I create a lot of shapes.. After all; That’s the reason I use BitmapData objects. Sometimes I let Flash render a whole night before saving it and maybe it create more then a million shapes. To be realistic; I think a million shapes wouldn’t be cool as vector graphic, I guess my Illustrator doesn’t like that or the printshop-dude starts crying ;) However.. I think there are tools to optimize/clean shapes that could be helpful too.

Open vector formats
I didn’t know this exist (because I never searched for something like this), but there is a lot information about a SVG file format. A lot of vector programs support it already and even modern browser could show SVG file formats too.
I found this and this link. The opposite would be an great idea; It could be cool if we could export SVG. While rendering we could write/add into a file. Then I could use a small bitmapdata object, just show it and render it real-time. Downside; I think SVG doesn’t support blendmodes or filters.

I really think there is a lot more to explore. If anyone have some other suggestions or ideas, feel free to post it.

Tagged with , , , . | Tiny URL http://tinyurl.com/mcw6v6

 

4 Responses to “Actionscript 3 to vector graphic”

  1. Hi Mark,

    I used to use bitmapData.draw() like a camera, taking multiple shots of a very large image and then stitching them together as a byteArray before exporting a single PNG. The actual exporting part was not too bad however, generating artwork across tens of thousands of pixels would cripple performance.

    My new approach is to generate the artwork at screen resolution and save the data as XML (ie: path co-ordinates, line weights, fill colors, etc). I then pass the composition data to a custom-built AIR app that instructs Illustrator and Photoshop to redraw the artwork at full-scale (using Switchboard). The rendering process is very fast and can output a 400Mb TIFF at 300dpi from just 60Kb of XML data.

    Rather than using my own schema, my next aim is to save the composition in FXG format: http://opensource.adobe.com/wiki/display/flexsdk/FXG+1.0+Specification

    Hope this helps,

    Andy McDonald
    Centre for Advanced Textiles
    Glasgow School of Art

  2. Mark Knol says:

    Hello Andy, thanks for replying and share your thoughts about this subject. If I get it right you only save positions, colors and fills etc as data and render this later as vector file? or as bitmap? I really like the idea of having a set data (xml) which is redoable. How do you exactly redraw the xml-data to photoshop/illustrator? What do mean with switchboard?

  3. Andy McDoanld says:

    Hi Mark,

    Apologies for not getting back to you sooner.

    ExtendScript is an extension of JavaScript that can be used to build custom scripts for Creative Suite tools. Each tool has its own API (ie: the Document Object Model) that provides access to most of the core functionality. Rather than triggering these scripts from the within the tool itself, SwitchBoard (http://labs.adobe.com/wiki/index.php/SwitchBoard) is a utility that allows them to be called from within an AIR app.

    The research centre where I am based specialises in digital printing onto fabric. We need files to be in TIF format (Lab color mode) therefore my AIR app actually instructs Illustrator to re-generate the composition as vectors before passing it over to Photoshop to rasterise and export as a bitmap. Although there are a lot of gaps in functionality, the export options are pretty complete so you can save the artwork in just about any format you wish.

    If you send me an e-mail then I can direct you to a video that shows this workflow in action.

    Cheers,

    Andy McDonald
    Centre for Advanced Textiles
    Glasgow School of Art

  4. Alex says:

    hey I’m very interested in this subject and I was wondering if one of you guys could walk me through. Ive been looking for something like this for a while now

Trackbacks

    Leave a Reply