The World of Raster

30 Nov, 1998 By: Lynn Allen

In today's world, it's not an uncommon practice to incorporate scanned documents, satellite photographs, digital photographs or rendered images into an AutoCAD drawing. Before Release 14, AutoCAD's support of the raster world was very limited, leading to a variety of comical workarounds. With the advent of the AutoCAD Image Support Module, the world of raster as we know it became much better! This month we'll tour some of the raster capabilities of AutoCAD R14.

What is a Raster Image?
Plain and simple, a raster image is a compilation of a bunch of dots referred to as pixels. The word pixel is derived from the words "picture element" (a little raster trivia). These colorized pixels are put together in a rectangular grid that mysteriously creates an image. Think of the painter George Seurat creating his artwork from a variety of colored dots that magically come together to create a picture, and you have a primitive raster image (I'm sure you art connoisseurs are cringing about now!). The specific color that a pixel depicts comes from a blending of the three components of the color spectrum-red, green and blue. Up to three bytes of data are used to specify a pixel's color-one byte for each color. All this information is stored in each little pixel, and it can add up to a fairly large file when you look at the entire image. Were it not for the clever method AutoCAD uses to store these graphic images with the drawing, you'd definitely notice your file size swelling with each inserted raster image.

The raster file is often referred to as a bitmap because it contains data that is directly mapped to the display grid. A bitmap is a file that contains the color information for each pixel along the horizontal axis (x coordinate) as well as the color for each pixel along the vertical axis (y coordinate). Enough about the details, let's move on to the good stuff!

Table 1. Raster Image File Formats Supported by R14

Type Description and Versions File Extension

BMP Windows and OS/2 Bitmap Format BMP, DIP, RLE

CALS-I Mil-R-Raster I GP4, MIL, RST, CG4, CAL

GIF CompuServe Graphics Interchange Format GIF

JFIF Joint Photographic Experts Group Format JPG


PCX PC Paintbrush Exchange PCX

PICT Mac Image Format PCT

PNG Portable Network Graphics PNG (patent-free replacement for the GIF)

TARGA Truevision TGA

TIFF Tagged Image File TIF

Table 1 lists the raster image file formats that are supported by AutoCAD Release 14. You'll notice that AutoCAD supports the most common raster-image formats. These file formats are found in applications ranging anywhere from document management to geographic information systems (GIS).

The AutoCAD IMAGE Manager
The IMAGE command is used to insert a raster image into AutoCAD. You can also reach this command from the Insert pulldown menu > Raster Image. When executed, this command displays the dialog box.

If you've experimented with the new External Reference Manager, you'll feel right at home in this dialog box. The Image Manager is used to manage the image definitions and the insertions of each image. Similar to xrefs, the image definitions are referenced but not saved within the drawing file. This is great news because it keeps your drawing file size down.

If you have set a project name (in Preferences), you'll see it display at the top of the dialog. The two buttons in the upper left-hand corner control whether or not the attached images are shown in a list or a tree format. List format displays the status, size, file type and date, as well as the physical location of the image file. You can sort the columns alphabetically or numerically by clicking on the column header. As with other MFC dialogs, you can hold down the Shift key to select multiple images and the columns are completely adjustable.

The tree view displays the images and their respective nesting level. If you have an image attached from within an externally referenced drawing, the Tree view makes it easy for you to visualize the nesting order. Should you feel the need to rename an image, you can do so by double-clicking on the image name and hitting the F2 key. Though hitting F2 may seem natural to you Windows pros, it took me a while to sort it out. Note: renaming the image does not affect the original file name. This works in both the tree and list views. Let's take a look at the options in the Image Manager.

Selecting the Attach button sends you to the Attach Image Dialog Box. Attaching an image creates an image definition, loads the image into memory and then displays the image. The image file does not get saved within the drawing file, keeping the drawing file size down. The concept works exactly like external references. Each time you open the drawing file, AutoCAD searches for the attached images and loads them into your drawing.

There's nothing to keep you from reattaching an image file multiple times within the same drawing. Each insertion will have its own unique clip boundary as well as its own settings for brightness, contrast, fade and transparency (we'll get to transparency another time).

Selecting the Browse button sends you to a standard file search dialog that helps you find your image file. After selecting the file, you can choose to change some of the Image Parameters (similar to the standard INSERT command). You can key in a location, scale factor and rotation angle, or you can manually specify this on the drawing screen.

The Details section contains the information about the selected raster file. If resolution information is stored with the image file, you can set the units to millimeters, centimeters, meters, kilometers, inches, feet, yards or miles. Unitless is the default setting when no such information is stored-image size will automatically be converted to the current AutoCAD units.

The resolution is measured relative to how many dots per AutoCAD Unit (for example: 300 dots per inch). The actual image size is measured in pixels.

More than likely, you'll want to ensure the "Select path" box is checked if you want AutoCAD to find the raster image in the future. If the box is not selected, the image name will be saved, but without the path information, causing AutoCAD to search the Project File Search paths and the AutoCAD Support Files Search paths for the raster image. If you plan on playing musical directories with the raster files, it might not make sense to save the path information with the image file.

Should you decide you no longer want to use a raster image in your drawing, you should use the Detach option to remove the image references as well as to erase the associated objects in the drawing. Simply erasing the image won't remove the reference (so don't do that!).

Unload and Reload
Too many raster images slowing you down? Though the images aren't stored with the drawing file, they take up precious memory to display within your drawing. Should you decide you don't need to view the images for the time being and could benefit from an increase in speed, unloading your raster images is the route to take. This doesn't actually detach the image, it just puts the raster image up on a shelf until you need it. The image frame or clipping boundary remains visible, so you'll know where the images reside within your drawing. You'll see the status of the raster image change within the Image Manager when you unload a raster image.

Need your raster image back in the drawing for plotting? Simply reload the selected linked images. Reload also comes in handy should you find the raster image has changed and you want to ensure you've loaded the latest version of the file. This happens automatically when you leave and reenter the drawing. (Note: you can easily reload and unload a file by double clicking on the word Load/Unload or Reload under the Status column.)

The Details button provides you with all of the intimate details about your raster image. Here you'll find much the same information as is in the initial dialog, such as file type, size, date, path and so on; you'll also find the color, such as RGB (red, green, blue), gray or palette and a color depth value.

The value of color depth (also known as pixel depth) for a raster image varies depending on how many different colors the raster image is capable of displaying. This is controlled by the number of bitplanes or the number of bits of information available to define a pixel's color. If the color depth or bitplane value is set to 1, a pixel can be black or white only. As the bitplane or color depth jumps to 8, a pixel can be any of 256 shades of color. When the color depth is set to 24, a pixel can display nearly 16.8 million shades (wow!).

As you select each raster file within the Image Manager, you'll see that AutoCAD displays the directory where the file was found. If you inadvertently move or delete this instance of the file, AutoCAD continues to hunt for the file using the standard search path set within Preferences and your current Profile. If AutoCAD still can't find the file, the words Not Found display in the Status column. Use the Browse button to reestablish a file's proper location and the Save Path button whenever you'd like to save new path information. If you browse to search for a raster file but do not use Save Path, AutoCAD will search the original search path the next time the drawing file is loaded.

You may also find it valuable to use the command-line interface with raster files by issuing the -IMAGE command. You'll find the command-line interface especially efficient when you need to perform global functions, such as unloading or reloading all the attached images in your drawings.

Well, we've covered a nice introduction to the world of raster. Next month, we'll take this one step further by delving into other raster related commands such as IMAGEADJUST and Clipping (my personal favorite!). Until next month...Happy AutoCADding!