|
Package |
com.coreyoneil.vectorization |
|
Classes
|
Vectorize, VectorizeGroup, VectorizePixel |
Language Version: Actionscript 3.0
Player Version: Flash Player 9
The Vectorization Package allows you to convert raster images to vector images at runtime, in the Flash Player. It is implemented through the Vectorize class. Two other classes, VectorizeGroup and VectorizePixel, play supporting roles and are not meant to be instantiated by the user of this package (and as such are not documented here).
The Vectorization Package is released under the MIT license.
To learn how to use this package, please read the documentation on the Vectorize class.
A Word About This Package:
Vectorization is the process of converting raster graphics into vector graphics. It is a computationally expensive process, and as such it is typically done on the user's computer with a program or plug-in capable of vectorization. Online vectorization services allow the user to upload a photo to a server, which then in turn vectorizes the image locally and returns the result.
This package of code is unique from those methods in that it performs the vectorization process within the Flash Player, at runtime, over several frames. For this reason, there are a few differences and limitations that should be noted:
- Because of the nature of Flash's drawing API, this package does not allow you to modify the final vector image as you might in the IDE. This also means you cannot save the final vector image to your machine as a vector-based file (such as an Adobe Illustrator file).
- Getting vectorization to work in the Flash Player meant avoiding things such as recursion (so as to avoid the SWF from potentially freezing/timing out). This makes the process (naturally) slower than typical vectorization methods such as Trace Bitmap in the IDE. The time it takes to vectorize an image will vary depending on the user's computer, the framerate, and the settings provided for the Vectorize class (ex - a threshold value of 5 will take significantly longer than a value of 20).
- Because this package spreads its workload out over frames, it will perform faster with higher framerates. Parts of the vectorization process will almost definitely decrease your FPS temporarily.
- The resulting vector image this package creates may have gaps, particularly when you're using a high value for the curveSmoothness property. This is unlike Trace Bitmap, which is faithful to color groupings overlapping one another, regardless of how curvy you make it.
- While this package has been tested quite a bit, I cannot promise that it will always succeed. As it is with all applications, if the user's machine is slow enough it may freeze. I can say, however, that I wrote and tested this package on a spectacularly lousy computer, and I have yet to have it fail on me, so you should be fine.