Home > Articles > Web Development > Dreamweaver & Flash

  • Print
  • + Share This
This chapter is from the book

Using Bitmaps (Also Known as Raster Graphics)

In this section you'll see how bitmap (raster) graphics can be used in Flash. Raster graphics have inherently unique characteristics that can't be created inside Flash. The only warning related to using this option is to make sure you really need raster graphics. The following are some cases that justify the use of raster graphics:

  • A photograph. The only time to consider using a vector alternative to a photograph is when the picture is of a very geometric object. Otherwise, photographs should be raster graphics.
  • A series of still images extracted from frames of a short video.
  • An image with special effects that can't be achieved with a vector tool, such as clouds, fire, water, and other natural effects. (Of course, this is an invitation for a talented artist to re-create such an effect by using a vector tool such as Flash.)

If you're unfamiliar with the difference between vector graphics and raster graphics, learning when one choice is better than the other can take some time. The file formats .gif, .jpg, .png, .bmp, and .pct are all raster graphics formats. However, just because a file was saved in one of these formats doesn't mean it was done appropriately. It's the nature of the image in the file that matters. If all you have is a .gif, for example, you need to first look at its contents to judge whether it's appropriate for raster graphics. Here's an easy way to decide: If you can trace or redraw the image in the file (with Flash's drawing toolbar, for instance), you're much better off redrawing it. If it's a photograph, you would never be able to trace it (so leave it as a raster graphic). If it's a picture of a plain box, maybe you could draw it and thus take advantage of all the benefits of vector graphics without even bothering with raster graphics.

To make matters slightly more complex, you can use Photoshop to create and edit layered bitmapped images. So when importing Photoshop documents you can decide exactly how to import each individual layer. In addition, Photoshop supports editable text, which isn't a raster graphic at all. Because importing Photoshop files is more involved, there's a separate section on importing such layered documents that follows the more general discussion of importing flat raster graphics.

Importing Flat Raster Graphics

Importing a flat raster graphic (that is, not a Photoshop file) is pretty simple to do. You just select File, Import, Import to Stage, to open the Import dialog box and then point to any raster graphic that Flash supports: .jpg, .png, .gif, .bmp, .tif, or .pct. That's it.

However, importing not only places the graphic on the Stage but also puts a master bitmap item into the Library. If you import a raster graphic and then delete the object from the Stage, the master bitmap item will still be in the Library (which you can find by selecting Window, Library). It's called a bitmap item, and it has a little icon that looks like a picture of a tree (as shown in Figure 3.6).

Figure 3.6

Figure 3.6 After you import a raster graphic, the bitmap item appears in your Library.

After a raster graphic is imported, you need to keep it in the Library. The bitmap icon that appears in the Library provides a way to specify how the image should be exported when you create a movie for the web. If you leave it unchanged, your raster graphics export under the default settings. You can also specify special settings for just that image. In the following task you'll import a raster graphic and explore some of these settings.

Adjusting Bitmap Properties

Flash imports all kinds of raster formats, but uses only JPG, GIF, or PNG in an exported movie. In addition, any raster graphic is generically called a bitmap item after it's inside Flash's Library. This means that no matter what file type you import, you must use the Bitmap Properties dialog box to choose between JPEG (and its compression level) and lossless GIF/PNG for exporting. If you decide to use JPG compression, you'll want to experiment with different settings and click the Test button after each change to see the effects on both image quality (in the little picture at the top left) and file size (in the text information at the bottom of the dialog box). See Figure 3.8. The process involves experimentation—making adjustments and viewing the corresponding results.

Figure 3.8

Figure 3.8 Selecting a low JPEG compression (10) and clicking Test provides a preview of the resulting image and its file size.

JPEG compression is usually the most efficient option. Unless you import a .png or .gif, Flash sets the bitmap properties to JPEG by default. It's slightly confusing because if you import a .jpg file, Flash uses Imported JPEG Data by default, as shown in Figure 3.9. This option tells Flash to maintain the imported file's original compression (that is, don't recompress). Leaving this option selected is generally desirable because it's a bad idea to recompress.

Figure 3.9

Figure 3.9 Only imported .jpg files enable you to use the JPEG compression contained in the original file.

Importing other popular formats, such as .bmp and .pct, also causes Flash to opt for JPEG compression by default. However, the Bitmap Properties dialog box displays a different option: Use Document Default Quality, as shown in Figure 3.10. Although this looks similar to the Use Imported JPEG Data option discussed earlier, it's a different option entirely. Leaving this option selected causes Flash to use a global setting to compress the file. The global settings are made when you publish the movie. These topics are discussed in more detail in Hours 19 and 24.

Figure 3.10

Figure 3.10 When you import non-.jpg files, you can use the global (default) quality settings for the whole Flash file.

You can control what compression method is used on individual imported images by simply deselecting Use Document Default Quality (or deselecting Use Imported JPEG Data for that matter—but keep in mind the earlier caution about recompression). When this option is deselected, a field appears where you can type the JPEG compression level you desire. Instead of guessing what compression level is best, you can use the Bitmap Properties dialog box to experiment. A lower number results in a smaller file but also lowers the quality. If you click Test after each change, you see a drastic difference between 100 and 1. After you make each change, you can click the Test button to review the effect on file size and quality, as shown in Figure 3.11. You should experiment until you get the best compromise of image quality and file size.

Figure 3.11

Figure 3.11 Setting the quality to 5 cuts this image size to less than 1/100 of its original, but the quality is visibly affected.

The image portion shown in the image window at the top left of the Bitmap Properties dialog box shows exactly how the image will look when it is exported. You can zoom into this window by right-clicking and then you can pan around to get a better view.

Figure 3.12 shows the results of using several different compression levels on the same image. Notice that JPG 80 and JPG 100 are almost identical in quality, but JPG 80 has a much smaller file size.

Figure 3.12d

JPG 100 355KB

Figure 3.12 The results of different compression settings on the same image shows how quality degrades and file size shrinks.

You get the ultimate quality by using the compression option Lossless (GIF/PNG). It is selected by default when you import .png and .gif files, but you can select it any other time you want to use it. When this option is selected, Flash leaves the image in its original state. This option always provides the best quality—but not without a price. File size is always highest when this option is selected. This is a suitable alternative if you're making a movie that doesn't need to download from the web—maybe if you're just making a presentation you'll deliver on your hard drive or CD-ROM. Otherwise, you should use this option only on images that you want to retain the best quality possible. If your imported image is a .gif that already has a small file size, selecting Lossless is perfectly suitable. And because even 100% JPEG compression causes some image degradation, the Lossless option is suitable for images that are particularly important. Finally, the only way Flash supports 32-bit graphics (that is, raster images with varying degrees of transparency) is through .png items that you set to Lossless. That is to say, the fact that PNG is the only format that supports transparency is another perfectly legitimate reason to use PNG.

Smoothing

Regardless of which compression option you use for your imported bitmaps, there's another option in the Bitmap Properties dialog called Allow Smoothing (as shown earlier in Figure 3.11). If you plan to scale or rotate the raster graphic, you'll want to click that check mark. Normally, a bitmap with its explicit number of pixels will look fine without smoothing. But smoothing lets Flash apply a tiny bit of blur when the image's pixels don't align perfectly with the screen's pixels (which will be the case when you rotate or scale an image). You can see the effect of smoothing in a side-by-side comparison in Figure 3.13.

Figure 3.13

Figure 3.13 Applying smoothing to the image on the left improves it when rotated, but the same effect makes the image look soft.

The downside of smoothing is that images can look a bit fuzzy—so don't use it if you're not rotating or scaling the image. Even if you're using the image in a detailed animation, you'll want to opt for smoothing. Compared to how raspy a modified image looks without smoothing, you'll probably want to click the check mark to allow smoothing when appropriate.

Importing Layered Raster Graphics

Flash CS3 can now import Photoshop .psd files. In my opinion this is—by far—the biggest new feature in Flash CS3! The value is that artists can work in Photoshop and you can very conveniently import the graphics they create. Compared to having the artist individually export each element and then you import it and place it in the correct position, this is a huge workflow improvement. What's doubly great about this new feature is that it's so intuitive there's not a whole lot to learn. Naturally, there are a few points I should make.

Like the Illustrator Import dialog, when you select File, Import, Import to Stage and point to a Photoshop file, you'll see all the layers and folders contained in the source Photoshop file, as shown in Figure 3.14.

Figure 3.14

Figure 3.14 Importing a Photoshop document lets you select how to import each layer.

There are some striking similarities in the Photoshop import dialog to the Illustrator one shown earlier—though this one is more advanced. You can see similar global options at the bottom left as to whether to keep objects in position and whether to convert layers into Flash layers or keyframes. Also similar is the way you can include or exclude layers by clicking check marks.

A particularly handy feature in Photoshop, called layer comps, lets you save multiple arrangements of your layers and their contents. Artists can include tons of layers with all the graphics for an entire project in a single Photoshop file. But then they can make multiple compositions—for example, one where only the layers related to the home screen in your project are visible and another where the layers for a video section are visible. With layer comps, artists can quickly view different arrangements without going through and turning layers on and off. When you import a Photoshop document with layer comps you'll see them listed at the top left, as shown in Figure 3.15. This gives you a quick way to select all the layers related to a particular layout.

Figure 3.15

Figure 3.15 You can use the Layer Comp drop-down to quickly select the layers related to a particular layout.

After you've selected the layers you want to import, you can set the options for how each layer gets imported on the right side of the import dialog. That is, provided you don't want to accept the defaults, you individually select each layer and make adjustments to the options on the right. All layer types can be imported as a flattened bitmap, which is—by far—the best way to retain the exact look created by the artist. You'll see slightly different options in text layers and shape layers as I'll discuss in a minute. But the big difference (over the Illustrator importer discussed earlier this hour) is that for each layer that you import as a flattened bitmap you can individually set the publish settings.

The publish settings for each imported layer affect the Bitmap properties for the contained objects when they appear in the Library. These settings are the same ones you just learned about in the section "Adjusting Bitmap Properties." This way, you can make the decision between JPG and PNG/GIF and whether to use the Flash document's publish settings for compression (or set them individually for each item). The funky thing is that the terms are slightly different than the ones you just learned! Where the Photoshop importer says "Lossy compression," that translates to JPG in the Bitmap Properties dialog (accessible by double-clicking an item after it's in the Library). Where the Photoshop importer says Lossless, that means PNG.

Although you'll always see the best quality by importing layers as flattened bitmaps, other options also have some value. In the case of text layers, you can opt to import as editable text. This way you can make edits to the actual wording later. However, realize you'll immediately lose any layer effects applied to the text. (Photoshop supports very detailed text effects that are unmatched in Flash.)

For both shape and text layers you can choose to keep paths and layer styles editable. In my experience, however, not only does this mean you'll see subtle differences in the image after it's inside Flash, but a complex Photoshop document translates to a complex Flash document. My advice is to be prepared to test any import process if you're not importing as flattened bitmaps.

To summarize the suggested workflow, select the layers you want to import (either by clicking the check marks or by selecting a layer comp, which effectively selects the layers for you) and then go through each layer to adjust the publish settings (or do this later via the Library item's bitmap properties). It's sort of amusing that the biggest new feature in Flash CS3 only took a few paragraphs to explain, but that just shows the feature is very intuitive.

  • + Share This
  • 🔖 Save To Your Account

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020