To calculate the size of an image, the formula used is: = Width x Height x Channels x Bits per channel. For example, for a typical 2000 by 3000 color RGB image, the width is , the height is , the number of channels is 3 (Red, Green, Blue), and the bits per channel is 8. The calculation would be 2000 x 3000 x 3 x 8, resulting in bits. To convert this to bytes, divide by 8, which equals Megabytes.
In another example, consider a 2000 by 3000 color Grayscale image. In this case, the width remains , the height remains , but the channels are changed to 1 (Grey) with bits per channel still being 8. The calculation becomes 2000 x 3000 x 1 x 8, giving a total of bits, which converts to Megabytes.
For a smaller custom image size, take an example of a custom 40 by 30 Black and White Image. Here, the width is , the height is , it has only 1 channel (Black), and the bits per channel is just 1. Thus, the calculation is 40 x 30 x 1 x 1, resulting in bits. When converted to bytes, this gives us Bytes.
Lastly, consider a custom image size of 50 x 20 that uses 8 bits per pixel. The width is , the height is , the number of channels is 1, and the bits per channel is . The calculation yields 50 x 20 x 8 = bits, which converts to bytes, equal to Kilobyte.