One of the most reliable ways of keeping the download time of your Flash movie quick is to use vector-based graphics in place of bitmaps whenever possible. Because vector-based graphics use mathematics to describe objects, as opposed to the pixel-by-pixel storage used in bitmaps, vector graphics usually, but not always, are the optimal choice. What kind of bitmapped images are suitable for conversion to vector graphics? It depends on the effect you are trying to achieve. If you try to convert a highly detailed image to a vector graphic, but still try to keep it as photo-realistic as possible, you'll end up with a vector image that produces a much larger file than you would have gotten by just using the original bitmap. However, if you don't need or want the bitmap to be photo-realistic , you might find that you can actually save file size and get interesting effects by converting it to a vector graphic. Tip You can use Macromedia's FreeHand or Adobe's Streamline to convert bitmaps to vector art. You actually have a higher degree of control over the final product by using one of these, but the Flash conversion process is very serviceable. When you import a bitmap into Flash, you have the option of using Flash's Trace Bitmap command (Modify > Trace Bitmap) to convert it to vector art. (See Figure 5.4.) Figure 5.4. You can control the appearance of your traced bitmap by changing the Color Threshold, Minimum Area, Curve Fit, and Corner Threshold settings in the Trace Bitmap dialog box.
There are four settings you can change when you're using Trace Bitmap:
By having all the settings, particularly the Color Threshold and Minimum Area, at their highest values, you can easily end up with a vector image with a larger file size than the original bitmap. In addition, choosing high settings is very CPU intensive . If you have a complex bitmap and you choose a setting of 0 for the Color Threshold and 1 for the Minimum Area, you might as well click OK and then go out to lunch . If your computer doesn't crash, it might be done with the conversion by the time you come back. After you've traced your bitmap, you can reduce the size even more by selecting the traced image and choosing Modify > Optimize from the main menu. Figure 5.5 shows the difference between an unoptimized trace and an optimized one. Figure 5.5. The image on the left was traced with a Color Threshold of 50 and a Minimum Area of 10. The image on the right is the same image optimized, with smoothing set to maximum. If you look closely, you'll see that the image on the right has more sharp angles and merged curves than the image on the left. The optimization reduced the number of curves by about 41 percent.
Note Just as a test, I traced the bitmap for the next exercise with a Color Threshold of 0 and a Minimum Area of 1. I left both the Curve Fit and Corner Threshold set to Normal. My CPU usage immediately spiked to 100 percent and stayed there for eight minutes. It took another eight minutes at 100 percent CPU to deselect the traced bitmap after it was complete. The final SWF file size was 332KB, as opposed to the 8KB file I got when I used the unaltered bitmap. That's a great example of how not to use Trace Bitmap. Exercise 5.2 demonstrates how these settings can affect your final file size. Exercise 5.2 Converting a Bitmap Graphic to a Vector Graphic The settings that you choose when using Trace Bitmap to convert a bitmap to a vector graphic have a significant impact on the final file size.
What's happening here? Compressed JPEGs always have artifacts created by the compression process. Those artifacts actually add to the file size when you are trying to use Trace Bitmap. As a rule, bring in the cleanest, most uncompressed file you have. Let Flash work its magic. Note How else could you approach this file? How about tracing the image and then separating out some of the flowers? Then you could convert the traced flowers to symbols and create your own bouquet. Alternately, you could skip using the Trace Bitmap feature and hand trace the elements of the bouquet you want to use, but that's a bit more time consuming. So, for your own work, how are you going to know what settings to choose? It's going to take a little "guestimation" on your part. You might have to convert the image several times before you get the look and file size that you're after. In addition, you might find that you need to rethink your approach altogether. If you're unhappy with the look of the traced image, just choose Edit > Undo until you have your original bitmap back. You then can change your settings and run the Trace Bitmap command again. You've imported bitmaps. You've converted bitmaps to vector graphics. What else can you do? You can import SWF files that were created by Flash or a third-party vendor. |