Images on a computer can be stored many ways to account for quality and space issues. One of the factors we can adjust is colour depth. Colour depth determines the number of bits we use for each pixel of an image. The pixels are the small dots that make up an image. The higher the colour depth (or bit per pixel), the more distinct colours an image can have. Some standard colour depths include 2-bit (CGA), 4-bit (EGA), and 8 bit (VGA).

a) Given an image that is 1024x768 pixels determine the size (in bytes) of the image at CGA, EGA, and VGA resolutions. (2 marks)

b) An image with dimensions of 400x800 pixels is compressed to save space. The compressed file is reduced to 76% of the original size, and now measures 972800 bytes. Determine the colour depth of the original image, in bits. (3 marks)
c) A computer generated sphere is covered with a texture. A texture is single image that is repeated many times in order to save memory. Given the sphere has a diameter of 1000 pixels, how many time must a 64x64 pixel image be repeated to cover the entire sphere? (4 marks)

a) 1024x768 = 788736 pixels.

Just multiply by 2,4,8 to get # bits used
Divide by 8 to get bytes.

b) The compressed size is 972800 bytes, so the full expanded size is 972800/.76 = 1280000 bytes.

Multiply by 8 to get bits.
Divide by 400x800 to get depth

c) Area = pi d^2 = 3141593 px^2

Divide by 64x64 to get replication factor. Assuming the repetitions would exactly cover the sphere.

a) To determine the size of the image at CGA, EGA, and VGA resolutions, we need to consider the color depth.

- CGA resolution has a color depth of 2 bits per pixel. This means each pixel can have 2^2 = 4 distinct colors. To calculate the size of the image in bytes, we need to know how many pixels are there in total. In this case, the image is 1024x768 pixels, so the total number of pixels is 1024 * 768 = 786,432 pixels. Since each pixel requires 2 bits, the total size in bits would be 786,432 * 2 = 1,572,864 bits. To convert bits to bytes, we divide by 8, so the size of the image in bytes would be 1,572,864 / 8 = 196,608 bytes.

- EGA resolution has a color depth of 4 bits per pixel, allowing for 2^4 = 16 distinct colors. Using the same calculation, the total size of the image at EGA resolution would be (1024 * 768) * 4 / 8 = 393,216 bytes.

- VGA resolution has a color depth of 8 bits per pixel, allowing for 2^8 = 256 distinct colors. The total size of the image at VGA resolution would be (1024 * 768) * 8 / 8 = 786,432 bytes.

b) The compressed file measures 972,800 bytes and represents 76% of the original size. To find the original size of the image, we can divide 972,800 by 0.76: 972,800 / 0.76 = 1,280,000 bytes.

Now we need to find the color depth of the original image, in bits. Let's denote it as "d". Since each pixel is represented by "d" bits, the total number of pixels can be found by dividing the original size in bytes by "d" (in bits): 1,280,000 / d.

We know that the original image had dimensions of 400x800 pixels, so the total number of pixels is 400 * 800 = 320,000 pixels. Setting up an equation, we have 320,000 = 1,280,000 / d. Solving for "d", we get d = 1,280,000 / 320,000 = 4 bits per pixel. Therefore, the original image had a color depth of 4 bits.

c) To determine how many times a 64x64 pixel image must be repeated to cover a sphere with a diameter of 1000 pixels, we need to calculate the total number of repetitions required.

First, we need to find the circumference of the sphere, which is given by C = π * d, where "d" is the diameter. In this case, the diameter is 1000 pixels, so the circumference is C = π * 1000 = 3141.59 pixels.

Next, we need to determine how many repetitions of the 64x64 pixel image fit into the circumference. To do this, we divide the circumference by the width of the image: 3141.59 pixels / 64 pixels = 49.09 repetitions.

Since we can't have a fraction of a repetition, we round up to the nearest whole number. Therefore, we need to repeat the 64x64 pixel image 50 times to cover the entire sphere.