Scientific Visualization: 2D image processing
Mathematics: Applied Algebra
Once this lesson has been completed, it can be used as a resource for other activities involving the production of presentation images.
Basic knowledge of a 2D bitmap drawing package such as Corel PhotoPaint is assumed. The terminology used in the lesson is fairly universal across drawing packages, but may vary some.
Other resource links:
An excellent comparitive Guide to Graphic File formats found at:
http://members.aol.com/arendsart/pages/infopgs/filetype.html
A more computer science oriented resource is File Format FAQ
http://www.faqs.org/faqs/graphics/fileformats-faq/
H x V = total pixel count

b = number of bits
2b = number of possible display colorsIn a one bit image, each pixel has either a 0 or a 1 to code color so only two colors-- black or white-- are used. An 8-bit image uses 8 places of binary code to code for the colors. That allows a palette of 28 (2 to the eighth power) = 256 colors or 256 shades of gray. A 24-bit color image works with a palette of over 16.7 million colors. Since most images don't have that many pixels, and many pixels use the same color, the actual number of unique colors displayed would be substantially less than 16.7 million. Still, the image must set aside the full 24 bits of computer memory for each pixel to give it the flexibility of displaying any of those possible colors. Most images you see either have a color depth of either 8 or 24 bits.
H x V x D = raw file sizeBecause all three of these variables are multiplied, an increase in any of the three adds to the file size.
Example problem:
What is the
size of an 8-bit image which is 220 horizontal pixels by 180 vertical
pixels?
220 pixels x 180 pixels = 39,600 total pixels
39,600 pixels x 8 bits/pixel = 316,800 bitsThis gives us the file size in bits, but computers refer to file sizes in bytes. There are 8 bits per byte, so:
316,800 bits / 8 bits/byte = 39,600 bytesAnd, since most files have quite a few bytes, it is more common for rounded Kilobytes to be used. Kilobytes may be abbreviated as K or Kb.
39,600 bytes = 39.6 Kilobytes = 40 Kilobytes = 40 K
1000 bytes/Kilobyte
In summary, our 8-bit image 220 horizontal pixels by 180 vertical
pixels would have a raw file size of approximately 40 K.
The two compression algorithms we will be using in this exercise are JPEG (also the name of the file format) and LZW. JPEG stands for Joint Photographic Experts Group and was developed to compress the kind of 'natural',continuous tone photographic images taken with cameras. It is also an example of a lossy compression technique. That is, in the process of compressing the image, information contained in pixels is discarded or lost. This process is done in a very calculated way and the missing information is not usually noticeable to the eye in rich, detailed natural scenes. LZW stands for Lempel, Ziv and Welch, the three researchers credited with developing the algorithm. LZW is a lossless technique which means no information is actually discarded. Instead, areas with the same information are coded to use less space to record the color depth. LZW compression can be used on any kind of image, though it is most effective on line art or images with large areas of uniform (same) color.
How much smaller the compression algorithm will make the file size depends on a number of variables:
Resolution is important because it determines the physical display size
of your image. The higher the resolution, the smaller the individual pixel
and, therefore, the more pixels that can be packed into a smaller area.
A higher resolution means a given image will take up less space on
the display surface. Dividing the number of pixels by the resolution will
give us the display size.
![]() |
Binary image size: 14x14 pixels
Resolution: 14 dpi Color depth: 8 bits From this information we can calculate: Display size: 14 pixels wide/14 pixels per inch
= 1 inch wide
Image size: 14 x 14 = 196 pixels Raw file size: 196 pixels x 8 bits/pixel =
1568 bits
|
The same image at higher resolution |
Binary Image Size:
14 x 14 pixels
Resolution: 28 dpi Color depth: 8 bits From this information we can calculate: Display size: 14 pixels wide/ 28
pixels per inch = . 5 inch wide
Image size: 14 x 14 = 196 pixels Raw file size: 196 pixels x 8 bits /pixel = 1568 bits
|
The same image with 24 bit color |
Binary Image Size:
14 x 14 pixels
Resolution: 28 dpi Color depth: 24 bits From this information we can calculate: Display size: 14 pixels wide/ 28 pixels per inch = . 5
inch wide
Image size: 14 x 14 = 196 pixels Raw file size: 196 pixels x 24
bits /pixel = 4704 bits
|
Let's look at the width of the output when a 220 pixel wide image is displayed at 72 dpi and then at 400 dpi:
Horizontal
size of image in pixels = width of displayed
image in inches
Resolution
220 pixels / 72 dpi = 3.06 inches
220 pixels / 400 dpi = 0.55 inchesSo an image which takes up 3 inches of your 72 dpi monitor screen screen may take up only .55 inches of a printout from your 400 dpi printer.
Similarly you can figure out the height of an image by dividing its vertical number of pixels by its resolution.
Vertical
size of image in pixels = height of displayed image
in inches
Resolution
Some software can simulate a resolution other than one the monitor
can display. For example, in page layout preview in Corel PhotoPaint, a
300 dpi image is simulated on a sheet of paper even though your monitor
might only be capable of displaying 75 dpi.
|
|
|
|
|
|
|
|
| TIFF | Tagged Image File Format | Used extensively in the print industry for line art and continuous tone images. Also for managing scanned images | Web-based images | Used and supported extensively in print-based graphics software. 24-bit color support. Multiple resolution support. | Non-standard with many different 'flavors'. Files can be huge if not compressed. | Users can chose type of compression, including LZW. |
| GIF | Graphic Interchange Format | Web-based images using few colors: icons, line art, graphs, etc. | Continuous tone images | Used and supported extensively in Web-based graphics software. Lossless compression. Does not introduce 'artifacts' into the image | Limited to 256 (8-bit) colors. Also limited to one resolution setting (72 dpi). | LZW used on all images. One level of compression. |
| JPEG | Joint Photographic Experts Group | Digital camera images, continuous tone images for the Web | Line art | Used and supported extensively in both Web and print-based graphics software. Effectively compresses continuous tone images. 24-bit color support. Multiple resolution support. | Lossy compression. Can introduce 'artifacts', particularly at high levels of compression and in line art. | JPEG used on all images. Level of compression is variable and can be set by the user. |
Figure 2.
This information can be used in a number of ways:
| 1. | Explain the main difference between bitmapped images and vector images: |
| 2. | What else are bitmap images called? (1 name) |
| 3. | What else are vector graphics called? (2 names) |
| 4. | You are given a continuous tone, 24 bit photographic
image which is 640 pixels wide and 320 pixels high.
a) Calculate the total number of pixels b) Calculate the raw file size in bits c) Convert the raw file size to bytes d) Convert the raw file size to Kilobytes e) If this image will be printed out on a 300 dpi printer how wide will it be? f) Would JPEG or LZW compression probably be best for this image? g) Which format TIFF, JPEG or GIF would be best for displaying
this image in a web page?
|
| 5. | How many different colors can the computer display in an 8 bit color image? |
| 6. | If every pixel in the image described in #4 was
a different color, how many bits of color information would be needed?
( Hint: it is somewhere between 8 and 24 bits) |
| 7. | You are given an 8 bit grayscale image which appears
to be 4 inches wide and 6 inches high on your 72 dpi monitor.
a) Calculate the number of pixels in this image. b) Calculate the raw file size for this image and convert it to Kb. c) How big will it be if you print it out on a 1000 dpi printer? d) How many shades of gray can be displayed in this image?
|
| 8. | You create a color coded line graph to display
on your web page.
a) What type of image is this? b) What file format would be best for it? c) Which compression algorithm would be most appropriate?
|
| 9. | An 800 pixel wide image is printed out. The width of the printed image is 2 inches. What is the resolution of the printer? |
| 10. | Calculate the width in pixels of an image which appears 3 inches wide on your 72 dpi monitor. |
| 11. | A typical computer monitor displays 1024 pixels wide by 768 pixels high. A typical laser printer can print on 7 1/2 inches of paper at 400 dpi. If you were creating an image that needed to both fit on the screen and on the printed page would it be the printer or the computer monitor that would limit the size? |
eeh 03/31/00