video

Lesson video

In progress...

Loading...

Hello, my name's Mr. Davison, and I'm going to be guiding you through your learning today.

The title for this lesson is Bitmap file Size Calculation, and it's from the Unit: Representation of text, images, and sound.

In this lesson, we're going to explain how resolution and colour depth affect the file size of an image.

We have one keyword for today, trade-off, which is accepting a limitation to achieve a beneficial outcome.

In this lesson, we're going to have two learning cycles.

Let's get on with the first one, calculate bitmap file size.

Items stored on a computer are measured by the number of bits used to represent the data within them.

Everything in a computer to do with data is represented by 1s and 0s.

You can see there, there are three different files that have been saved on a computer and the amount of bits used to represent the data within them varies significantly.

When dealing with images, the data in bitmap images has two properties.

We have the resolution of an image.

And the resolution are the number of pixels across by the number of pixels down.

So in this example of a waterfall, we've got 600 pixels wide by 400 pixels high.

That constitutes our resolution, and together with that, we have the colour depth, which are the number of bits that we use per pixel to represent colours.

In this case, the colour depth is 16 bits, so it uses a sequence of 16 consecutive bits per pixel to represent the colours.

These properties are so important to remember.

Which ones do you think are properties of bitmap images from the four that you can see? The correct answer is resolution and colour depth.

Remember, resolution measures the pixel dimensions of the image, and colour depth, the number of bits that we use to represent the colour of each pixel.

When we're going to calculate a bitmap file size, we need to use the combination of those two properties.

So if we take our resolution of 600 by 400, we know that that resolution can be expressed as dimensions, so 600 x 400, but we can multiply those two numbers together as well to tell us that there are 240,000 pixels used to create that image.

If we put those two properties together, that there are 240,000 pixels each of 16 bits, we can work out that the file size is the multiplication of the resolution and the colour depth.

If we put the numbers into our calculation, 240,000 multiplied by 16, we can calculate that the file size is 3,840,000 bits.

It's important to be able to calculate that and know which properties are determining the file size.

Can you use the words given underneath to fill in the gaps to make the calculation correct? So the right answer is, that the file size is equal to the resolution multiplied by the colour depth.

Now, we just saw that the amount of bits was quite large, and we know of techniques that we can use to make it easier for humans to understand what those values represent.

The first thing that we tend to do in computing is to turn bits into bytes by grouping them into groups of eight.

We use the fact that 1 byte = 8 bits just to shorten the amount of bits that we're dealing with, but still let us, as humans, understand what we're considering as our values.

Once we establish that fact, as Izzy is saying here, if we know that a byte is a group of eight bits, the total number of bits divided by eight is going to work out the number of groups and therefore the number of bytes.

Anytime that we're converting from bits to bytes, we need to take our total number of bits and divide by eight to work out how many bytes that would represent.

Going back to our original image where our file size was 3,840,000, if we take that number and divide by eight, we can work out that the file size in bytes is 480,000.

A little bit easier to comprehend, but still quite a large number.

So as Lucas is saying here, it's probably easier again for humans to take those large values and represent them as multiples.

480,000 bytes is probably better expressed as 480 kilobytes.

And rather than writing out the term kilobytes or megabytes, we often shorten the units of storage to just a few letters.

So one kilobyte would be expressed as 1 kB, one megabyte, 1 MB, and so on.

So all that's left for us to do to summarise that file size so that it's easier for us to comprehend and compare is just to translate that into a multiple.

In this case, we're gonna use the kilo multiple, and our file size is now expressed as 480 kilobytes.

You are going to have a go now for this first task.

What I want you to do is consider a bitmap image described by its resolution and its colour depth.

I want you to write a description of what these are and how they're used to determine the file size.

Once you've done that, you then need to compare the file size of two different images.

Fill in the gaps with either a <, > or an = symbol to make each statement correct.

For the third part of the task, we've got a scenario where Aisha has a camera that takes photos stored as bitmap images at a resolution of 8064 x 6048 together with a 10-bit colour depth.

Sophia's got a camera that takes photos, but the bitmap images it creates are 50 megabytes and a colour depth of 24 bits.

What I want you to do is work out whose camera takes photos at the highest resolution.

Well done.

You did really well there.

Let's check your answers against mine.

So first part, we had a bitmap image described by its resolution and colour depths.

We had to describe what these are and how they were used to determine the file size.

Well, we know that the resolution is the number of pixels used to represent the image and can either be referred to by the total number of pixels or its pixel dimensions.

Colour depth is the number of bits used per pixel to represent colours.

Therefore, a bitmap image file size is the resolution multiplied by the colour depth to tell us how many bits would be used to represent that image as a file.

For the second part, we had to compare the file size of two different images.

So our first step for both of them was to calculate the equivalent file size based on the resolution and the colour depth.

For the first one on the left hand size, the resolution was 20 x 20 pixels with a 4-bit colour depth.

So, if we work out the resolution is 20 multiplied by 20, and then multiply that again by four, the first file size of that image is 1600 bits.

Working out the file size of the one we need to compare it against, 500 pixels at a 3-bit colour depth, we have 500 multiplied by 3, giving us 1500 bits.

So the one on the left is larger than the one on the right, so we put our greater than symbol in there.

For the second example, the image on the left uses 8000 pixels as 24-bit colour depth.

So 8,000 multiplied by 24 gives us 192,000 bits.

Again, we need to work out its equivalent on the right hand side.

In this case, it's 300 x 200 pixels at an eight-bit colour depth.

So multiplying firstly the 300 by the 200 to work out the number of pixels, and then multiplying it by that colour depth of eight-bits gives us 480,000 bits.

The one on the right is larger.

Therefore, we put the less than symbol in to make sure that we express that the image on the right is larger than the image on the left, or, in the way that it's written there, the image on the left is less than the image on the right in terms of its file size.

Lastly, we were comparing Aisha and Sophia's different cameras in terms of their resolution to work out which of the two cameras takes photos at high resolution.

With Aisha's camera, we've got the two different pixel dimensions that we multiply together to work out the resolution in terms of the number of pixels for Aisha's camera, is 48,771,072 pixels.

For Sophia's camera, we've only been given the file size and the colour depth for the images that it creates.

So we've got to use our calculation but rearrange it a little bit to find out what the resolution is.

We were told that Sophia's bitmap size was 50 megabytes, so if we change that into bytes, we know that's 50 million bytes.

We then need to take it and express it as bits.

So we know if there are eight bits per byte, 50 million bytes multiplied by eight gives us 400 million bits per image.

If we rearrange our calculation, we can work out the resolution is the file size divided by the colour depth.

So 400 million divided by 24-bit colour depth gives us 16,666,666 pixels.

From that, we can conclude that Aisha's camera takes photos at a higher resolution.

Well done.

You did really well with that.

Let's get onto our second learning cycle where we're going to justify image quality based on usage.

How a bitmap image will be used is going to affect decisions about the quality and file size of our image.

Higher resolution and higher colour depth of images does improve the quality, but we found out that it also increases the size of the file.

This means we're going to have to have a trade-off between quality and file size if either negatively affects the way that an image is going to be used.

For example, an image on a webpage article might need to fill a part of the screen and still appear clear and detailed.

A 600 x 400 16-bit image will be clear enough to use as an illustration on screen as it's not filling up a significant proportion of the overall size of the screen it's being displayed on.

The file size of 480 kilobytes is also not going to significantly increase the loading time of the page.

If we use that file as part of a webpage, the user would experience a responsive webpage, which is something we want.

We don't want our users to be waiting for a webpage to load, or when we scroll down, waiting for more images to load.

That was fine for a single image on a part of a webpage, but imagine now we've got a group of 600 x 400 16-bit images, but they're going to be physically reduced in size on our webpage.

Each image is still going to have a file size of 480 kilobytes, so we've got the same images as before, but all we've done is make them smaller.

That's not really going to affect their file size.

So let's just check if you've understood that important point.

If we reduce the physical size of an image, what happens to its file size? Good.

We know that if we reduce the physical size of an image, then it has no effect on its file size.

So going back to that page of nine images, each image is going to contribute to the overall total of the amount of file storage that needs to be put aside and then downloaded when the page loads.

This means we're gonna have over four megabytes of photos to load, which is going to add significantly to the time taken for the page to load.

If a user is viewing that webpage, their experience might be impacted as they may experience delays in accessing the page, waiting for the images to download.

However, as the images are smaller, they're not going to need the same level of detail.

They're still usable for this purpose if we reduce the quality, because it won't be noticed because they're a lot smaller.

If we halve the resolution to 300 x 200 and the colour depth to 8 bits, it will result in the file size of each image being reduced to 60 kilobytes.

Instead of around four megabytes of photos to load, now, there would instead be 0.

54 megabytes.

Quite a difference.

What we've seen is we've traded off quality to get back lower file sizes.

So this trade-off has reduced the quality, but it's benefited the overall file size by improving the loading time of the page and it won't have any noticeable effect to the quality and the perception of the user using the website.

So let's just check you've understood that.

Which statements are correct about the trade-off between image quality and file size? Well done.

If we increase the quality, then that's going to result in a higher file size.

If we decrease the quality, that's going to result in a lower file size.

So lower resolution images that are made physically smaller were great for that purpose that we've just seen.

However, if we take those small images and expand them to fill the screen, we are going to see that the user is going to perceive some of the lack of quality in the images.

Physically enlarging a 300 x 200 8-bit image is going to result in poor quality images.

What we can notice in this example is, as we've expanded that smaller image to a larger size, we can start to notice the pixels of that image in an effect called pixelation.

What we've got to consider then, as we make that image larger, if we want to have a high quality image and we want our user to perceive the image as high quality, we're going to need to increase the resolution and the colour depth.

In this case, we might require something around the resolution of a typical screen that it'll be used on, 3840 x 2160 pixels, and to see some of the difference in colour, a colour depth of 24 bits.

In this case, the file size would be approximately 25 megabytes, significantly higher than before.

That would mean, on a low bandwidth internet connection, that image is going to take a little longer to download and smaller images.

You'll notice, we can't have high quality and low file size together.

We have to make a decision based on how we want to use the image.

Let's get on with the final task for today.

Our first task is helping Andeep and Sophia.

Andeep and Sophia want to use an old smartphone with a six megapixel camera to take photos of the school garden when animal movement is detected.

The images captured will be viewed on the same phone.

Andeep believes that they have a problem though.

Alex has told him that he has a 50 megapixel camera at home and that the six megapixel camera that they're going to use won't be good enough quality.

Sophia, though, doesn't seem worried.

She's saying that the phone screen is 1600 pixels by 960.

She thinks it's fine.

Can you explain why Sophia is correct not to be concerned? Once you've done that, I want you to complete the table to compare different uses of bitmap images, select the most applicable trade-off, and justify your choice for the uses that are given.

Well done.

You really applied that knowledge well.

Check your answers against what I've put.

So in the first part, Sophia was correct not to be concerned.

Sophia is saying that the resolution of the screen is 1600 x 960 pixels, and overall, that's going to create images of 1,536,000 pixels.

The camera itself is six megapixels, which means it's going to take images that constitute 6 million pixels in total.

That's way more than the screen can display.

Therefore, the images are going to display with enough detail on that particular screen without the image appearing pixelated.

For the second part, we had to compare the different uses and decide if we wanted low quality, low file size images or high quality, high file size images.

When we're printing an A2 size poster, we are going to need high quality.

If we don't have that and stretch a small image to a larger size, in this case, A2, A2 is a lot larger, so we need that level of detail as the image gets larger.

For the second row of the table, the use was emailing a hundred countryside holiday photos.

Now, in this case, we probably want low quality and low file size, and that's because the total size is likely large, and if we are emailing them and going to send them, we might have restrictions with bandwidth, we might have restrictions with the amount of data that we can attach to the email itself.

So unfortunately, we're gonna have to accept that the images are gonna have to be lower quality so that we can get the overall file size as low as possible to make it work in the way that we need it to.

For the last row, we had a map of a rail network displayed on a large screen.

We're going to need high quality and accept a high file size with this, because that image is going to have a lot of detail, and when we stretch it to display on the large screen, that detail needs to be clearly visible.

We can't accept blocky images where things can't be made out.

So because we need that detail, it's got to be visible on a large screen as it's made bigger that will result in a higher file size, but we have to accept that because we need that quality.

Well done.

We covered a lot today.

Let's just recap what we learned.

We found out that bitmap file size is calculated from its resolution and colour depth.

We also found out that increasing either the resolution or the colour depth is going to increase the file size.

These things are related, and when we change one or the other, it's gonna have some knock on impact.

So, we could say that the choice of a higher quality image comes at the cost of a higher file size.

Depending on the use, there may need to be a trade-off between quality and file size.