Earth Analysis Techniques > Image Analysis Modules > Advanced Image Analysis > Day 1—Get to Know Your Digital Image > Part 1: Digital Images and Image Files

Part 1: Digital Images and Image Files3

Digital images carry information. To access, analyze, and manipulate that information, you need tools. A computer is one of those toolsan image processing application is the other. The user's goals determine the type of application to use. To work with aesthetic information in digital images, use a tool like Photoshop. To work with scientific information, you need a different type of tool such as ImageJ. Despite these tools' different purposes, they work the same way "under the hood", using mathematics to to do their work.

The first step to understanding image information is to load that information into the tool. This course is called "Advanced Image Analysis" so the first topic covers advanced methods of getting image data into ImageJ. After that, you'll review, reinforce, and extend your understanding of the characteristics of digital images.

Throughout this course, keep your files organized. This will help you focus on the learning objectives, save you time, and reduce frustration. Before you begin, create a folder somewhere on your computer for your Day 1 files.

Download an Image of Recent Fire Activity

Start with a typical scientific image you might to work with. This image from the NASA Earth Observatory shows recent fire activity in New Mexico.

  1. Click here to open a web page containing the image.
  2. Right-click (PC) or Option-click (Mac) the image and save the image to your desktop or to the Day 1 folder you set up for this module.
  3. In most browsers, you can also simply drag the image from the web page and drop it onto the desktop or folder to save it as a file. Try saving the image to a file this way as well.

Opening Images

Previously, you learned the traditional way of downloading and opening images in ImageJ.

Opening images the traditional way

Cool image opening tricks

There are other cool ways to open images in ImageJ that you may not be aware of. These techniques work for single and multiple images, on both PCs and Macs. (Close, minimize, and move windows as needed as you practice these techniques.)

  1. Drag-and-drop files from the desktop Drag the image icon from the desktop (or the folder) and drop it on the ImageJ status bar. Be patient while the image downloadsthe download speed depends on your computer and your network connection.
  2. Drag-and-drop folders from the desktop Drag a folder containing images from the desktop and drop it on the ImageJ status bar. You have the option of opening multiple images in separate windows or as a stack.
  3. Drag-and-drop images directly from the web page Drag the image from the web page and drop it on the ImageJ status bar.
  4. Drag-and-drop image URLs into ImageJ Drag the link from the address bar of your browser and drop it onto the ImageJ status bar. This opens the image directly into ImageJ. (Note: If you drop a URL for an entire web pagenot just a single imageon the ImageJ status bar, ImageJ will open that page in your default browser.)
  5. Import the URL into ImageJ Copy a URL from anywhere, choose File > Import > URL, type or paste in the address of the image, and click OK.

Click to play video.

loading the player

Digital Images

Drawing on your experience and background, how would you define a digital image?

A digital image is a rectangular array (a grid consisting of columns and rows) of numerical values that is displayed as pixels on a computer monitor or other display medium.

Basic digital image characteristics

See what you remember about digital images by answering these questions.

  1. What devices can create digital images?

    Digital images can be created in many ways, including still and video cameras, telescopes, scanners, or any device capable of making measurements that can be arranged as a grid. Digital images can also be purely mathematical, generated by using a formula to assign values to the grid. This type of image is called a synthetic image, because it was synthesized numericallykind of an image from scratch.

  2. What are the three "dimensions" of every digital image? Where in ImageJ do I look to see this information about an image?

    Digital images are defined by their width, height, and bit depth. This information is in the image window status bar at the top of every image window.

  3. What are the advantages and disadvantages of increasing the spatial resolution of an imagethat is, using more rows and columns of pixels to represent the same "scene"?

    Increasing the resolution of an image (on a digital camera, this would equate with "more megapixels") increases the details in the image that you can see clearly, but it also increases the size of the image. Doubling the resolution squares the memory required to store an image. For example, doubling the spatial resolution of a 3MB image produces a 9MB image. Computer memory and storage both fill up faster with larger images. The good news from this is that reducing an image to 50% of its original spatial resolution reduces the memory it requires to 25% that of the original! Shrinking a 64MB image by 50% creates a 16MB image.

  4. Where do you look to see the coordinates and value of a single pixel?

    Pixel coordinates and values are displayed in the ImageJ status bar.

  5. How could a student produce a digital image without the use of any type of camera or mathematical formula?

    Example: Mark out an area such as a football field in a rectangular grid, measure and record the surface temperature at the center of each grid square in a spreadsheet, save the data as a delimited text file, then import the text file as an image into ImageJ. Students can do this to create microclimate maps of their school or some other study area.

  6. What does "bit depth" mean? What are the advantages of creating an image with greater bit depth? What are the disadvantages?

    You can think of bit depth as the third dimension of an image (width and height are the first two). Bit depth defines the number of unique pixel values that can exist in an image. Since pixel values are coded as binary (base 2) numbers, bit depths refer to powers of 2:

    • 1-bit = 21 = 2 gray levels (black and white)
    • 2-bit = 22 = 4 gray levels
    • 4-bit = 24 = 16 gray levels
    • 8-bit = 28 = 256 gray levels
    • 16-bit = 216 = 65,536 gray levels
    • 32-bit = 232 = 4,294,967,296 gray levels, but you'll learn more about these later.
    • RGB = 3 8-bit channels = 23x8 = 16,777,216 colors

    A sequence of 8 bits is also called 1 byte. An 8-bit image uses 1 byte for each pixel; a 16-bit image uses 2 bytes; a 32-bit image uses 4 bytes; and an RGB image uses either 3 or 4 bytes per pixel. (More on this later.)

    The obvious advantage of increasing the bit depth is that each pixel can represent a greater range of values and record measurements more precisely. The disadvantages are that doubling the bit depth doubles the memory and increases the storage needed for the image, and that not all computer applications handle images of different bit depths. ImageJ natively works with 8, 16, 32, and 24-bit RGB images, and can open (and convert) images of other bit depths to its native formats.

Storing digital images

An important concept to remember is that storing all this information in an image file on your computer is much more efficient than it seems. The computer doesn't need to store the x- and y-coordinates of each pixeljust the pixel values, in one long string.

To reconstruct the image correctly, the computer just needs to "know" the number of columns and rows in the image. This information is usually included in the file (in a part called the "header"), along with the actual pixel values. It's like the senior class marching into graduation in a single line and filing into separate rows to be seated. As long as you have the right number of chairs in the right number of rows, everything will turn out fine.

A grid of rows and columns is also called a raster, which is why this type of digital image is also called a raster image and why ImageJ is called a raster image processor. The other type of image processing is vector processing, in which images consist of points, lines, and shapes that are definedand processedmathematically.

Histograms and pixel statistics

Sometimes it's very useful to look at pixel values statistically. For example, if the pixel values in an image represent temperature, it might be useful to know the average (mean), the middle (median), or maybe the most common (mode) temperature in the image. ImageJ can sort out the pixel values in an image for you and give you this information in a flash.

Histograms are a basic tool for understanding the data in digital images. As you'll see in the next section, histograms can be a key to understanding digital images, deciphering any processing that has already been done to the image, and determining whether you can do any useful scientific analysis of the image.

Image Types

ImageJ refers to the bit depth and number of channels (such as color bands) of an image as its type. In this section, you will explore and learn some of the characteristics of the different image types available to you.

8-bit (grayscale, uncalibrated)

8-bit grayscale images are the most common type used with ImageJ, since 256 possible values is sufficient for most purposes, providing a good balance of image resolution and size.

8-bit (grayscale, calibrated)

The pixel values in the previous image show relative elevationpixels with higher values are higher in elevation than pixels with lower values. In a calibrated 8-bit image, the values provide actual elevation information.

If you ever need "quickie" images to practice with, demonstrate on, or just to amaze your friends, ImageJ has built-in links to more than 30 sample images of various bit depths, types, and subjects. Before moving on to the next image type, we will look at one of these sample images to review other basic principles of digital images.

16-bit (grayscale)

Radiometric Resolution

The spatial resolution of digital images is a function of the number of pixels in the detector and the angle of view of the lens system.

Another name for bit depth, at least when talking about cameras and other devices that measure and record data, is radiometric resolution. In other words, what range of values, from lowest to highest, can the instrument record? Newer image detectors and instruments provide greater information in this third dimension. Even modern consumer digital cameras routinely capture 10, 12, 14 or more bits per pixel per RGB channel before reducing the depth to 8 bits for the final image. When available, the "raw" format of these cameras saves all of the bits for each channel, usually in a proprietary format, requiring special software to open and process raw files. Scientific imaging systems often provide full 16-bit radiometric resolution65,536 possible valuesor higher. ImageJ can work with images of these bit depths.

The DEM was a synthetic image. Let's look at a 16-bit image created with a camerathis one attached to a telescope.

32-bit grayscale

Another common scientific image data type represents measurements using 32 bits (4 x 8 bytes) per pixel. This type is often called "32-bit floating point" data, because the values are stored as positive or negative decimal values with a certain number of decimal places of precision. In effect, the pixel values are stored in scientific notation Thus, it you measure a temperature at some location as -17.6 degrees Celsius, you can code the pixel value as exactly -17.6 (-1.76 x 101. There's no need to density calibrate the image because the pixel values are the measurements. If necessary, scientists can increase both the range and precision of their measurements by using even more bits per pixel, such as 64-bit floating point data. ImageJ is limited to images with 32-bit floating point (also called "32-bit real" or "32-bit float") values.

A data source you are familiar with that provides images in 32-bit real format is the NASA Earth Observations (NEO) web site.

"Binning" data

Any time you have a histogram with more than 256 possible pixel values, you will be asked to specify the number of bins. The histogram can't show each individual floating point pixel value on the X (value) axis, so it divides the range of values from X Min to X Max into the number of equal-width bins you specify. In the example you just did, the values in the image range from 0 to 413.58 W/m2. Dividing that range by 256 bins means that each bin is 1.62 W/m2 "wide". The first bin goes from 0 to 1.62, the second from 1.63 to 3.24, the third from 3.25 to 4.86, and so on. The pixel at location 346,607 has a value of 4.3307085W/m2m so it would go in the third bin.

24-bit RGB (True Color)

You have displayed some grayscale images as pseudocolor images by applying color lookup tables. How are realistic, true color images created?

8-bit Color (Indexed Color)

You may also work with color images in 8-bit color format.

Converting Between Image Types

ImageJ can convert back and forth between most image types. This is a useful feature, but let's see if there are any down sides to image type conversion.

What happens to the image data when you convert from a higher bit depth to a lower bit depth? (Example: From 16-bit to 8-bit)

The number of possible pixel values is reduced, and the data may be completely destroyed to preserve the original appearance of the image.

How about converting the 8-bit color image to 8-bit grayscalewhere would that get you?

They are exactly the same! When you create a histogram from a color image, the values are first converted to grayscale equivalent values. By the way, ImageJ does not convert R, G, and B values to grayscale by simply averaging them. The conversion equation weights each color channel to match how each color contributes to your perception of brightness. The formula it uses is: 30% Red + 59% Green + 11% Blue. You could confirm this by choosing a pixel in the original RGB image, write down its RGB values, run them through this formula, then look up the value of the same pixel in the 8-bit grayscale conversion of the same image.

File Formats for Science

In everyday life, users are interested in the appearance of images and videos and having a simple, inexpensive, yet pleasing user experiencepictures are sharp and colorful and video playback is smooth, with good sound. Consumer-oriented file formats provide these qualities while allowing the files to be sent quickly over computer and phone networks and maximizing the number of pictures and videos that can be stored on a device.

Scientists have a different set of priorities. Their images, both still and "moving", contain important information that often needs to be preserved in a form that retains all of the original data. Scientists often use consumer file formats like JPG, GIF, BMP or movie files such as AVI, MOV, WMV, and FLV, but sometimes they need to preserve the original measurement values for each pixel in their images. This is where file formats like TIFF (Tagged Image File Format) and (Flexible Image Transport System) come in, because they are better suited to storing the metadata that are important for scientific tasks.

FITS is used mainly by the Astronomy community. FITS is much more than an image format (such as JPG or GIF) and is primarily designed to store scientific data sets consisting of multi-dimensional arrays (1-D spectra, 2-D images or 3-D data cubes) and 2-dimensional tables containing rows and columns of data. Unlike other file formats, both FITS and TIFF files can contain one or many related images plus their metadata. ImageJ Is able to open most TIFF and FITS files, and can save single images in both formats.

ImageJ can open and save images in many different file formats. Some formats you're familiar with, and some you've never heard of and may never use. Without going into great detail, it's useful to be familiar with a few of the more common image file formats, and their pros and cons. In other words, "Why would I want to use this format instead of that format?"

TIFF (Tagged Image File Format)

JPEG (Joint Photography Experts Group)

GIF (Graphic Interchange Format)

PNG (Portable Network Graphics)

To repeat a VERY important pointno matter what file format is used to store an image or how small that file is, the amount of computer memory the image occupies when the image is open is determined only by the dimensions of the imageits width, height, and bit depth. In image processing, then, other than conserving storage space, there's no advantage to saving images in JPG format, and there may be some serious disadvantages. We're not suggesting that you never use JPEG format, but it's a good idea to be aware of what happens when you do use it for your images. JPEG compression (quality) settings in ImageJ range from 0 (high compression, low quality) to 100 (low compression, high quality).

Your Assignment: Locate a Digital Image, Analyze It, and Describe Its Characteristics in Detail in Terms of Bit Depth and Pixel Histogram Distribution

  1. Spend several minutes opening and exploring the other sample images. Several of the samples are multi-image stacks. You can look at the stacks now, but don't spend too much time analyzing them—you will look at them in more detail in Part 2. For the single images, examine all of the basic aspects of the image: dimensions, data type, histogram, etc. You are using ImageJ primarily to view and analyze earth science data, but you can tell from these images that it is a general-purpose tool that can be used with any type of digital image.
  2. Choose one of the sample images or ANY other digital image you like, create a histogram of the image, and create a screen capture showing the image and its histogram.
  3. Go to the Part 1: Share and Discuss Page, post the screen capture and describe as much as you can about it, in terms of the characteristics explained in this section (e.g. bit depth, histogram data).

Screenshot Instructions for Mac Users

Screenshot Instructions for PC Users



1Adapted from Earth Exploration Toolbook chapter instructions under Creative Commons license Attribution-NonCommercial-ShareAlike 1.0.
2Adapted from Eyes in the Sky II online course materials, Copyright 2010, TERC. All rights reserved.
3New material developed for Earth Analysis Techniques, Copyright 2011, TERC. All rights reserved.

« Previous Page      Next Page »