# How to Calculate the File Size for a Digital Image?

In this blog post, you’ll read:You should consider and calculate these parameters carefully when choosing industrial x-ray equipment for adequate image handling. Improved image quality often ends up with two divides. On one side is the improved bit depth of the digital detector and on the other side is the increased file size.

### 1. what is the resolution and bit depth of digital detectors?

A vital part of any industrial X-ray machine is the detector.

A detector is a device on which an inspected product is projected after beaming an X-ray on it. The state of the image produced is profoundly dependent on performance parameters like the resolution and the bit depth of the detector.

So, you might be pondering on what exactly is the bit depth and resolution of a detector?

To understand the bit depth, you’ll first need to understand what a pixel is.

A pixel is the smallest individual element within a picture. Pixels are more like a cell within a picture that cannot be divided further into anything smaller. Hence, the pixel serves as the foundation on which the building blocks of an image are built. The more the pixel, the higher the quality of the picture.

Bit depth measures the level of lightness or darkness of a pixel, often contributing to the quality of the image produced and the picture’s file size. It means that a higher bit depth will give a larger image file size and better image quality.

On the other hand, the resolution is the number of different colors that a detector can identify within an image. It is often very critical for image quality. The more the number of different colors in an image, the more the image’s quality will be.

You should consider and calculate these parameters carefully when choosing industrial x-ray equipment for adequate image handling.

### 2. How to calculate the file size for a digital image?

Improved image quality often ends up with two divides. On one side is the improved bit depth of the digital detector and on the other side is the increased file size.

Even though this means improved visual assessment of the image, the storage occupied by this image quality and size is usually massive. It can be a source of worry for most IT personnel.

The ability to calculate the bit depth of a digital image will enable you to determine a digital image’s file size effectively. This knowledge is critical in handling digital images. It allows you to arrive at an optimum image with good quality without unnecessarily increasing the file size.

So, let’s walk you through how you can calculate the file size of your digital image.

Firstly, you’ll have to get the detector’s total pixel number. This calculation entails multiplying both the horizontal pixel and the vertical pixel of the detector together. It provides you the total quantity of pixels of the detector.

Secondly, multiply this pixel number by the bits in the bit depth. Generally, detectors come in bit depths ranging from 10 bits to 16 bits. The human eye can mostly register shades of gray within this range.

Thirdly, divide the product of the pixel number and the bits by 8 to get the file size in bytes. This division is because 8 bits are present in a byte.

Finally, to convert the file size from bytes to kilobytes, you’ll have to divide your answer above by 1,024 as there are 1,024 bytes in 1 kilobyte.

Further conversion of the file size from kilobyte (KB) to megabyte (MB) will involve dividing the kilobyte size by 1,024 to get the file size in a megabyte.

The formula

File size in kilobyte (KB) = (horizontal pixel x vertical pixel) x bit depth / (8 x 1,024)

File size in megabyte (MB) = file size in kilobyte / 1,024

For practice, let’s consider

I. Perkin Elmer 1621 flat panel X-ray machine detector with 16 depth bit and 2,048 horizontal pixels and 2,048 vertical pixels.

II. PaxScan 2520 flat panel detector with 16 depth bit and 1,920 horizontal pixels and 1,536 vertical pixels.

Calculation

I. File size in kilobyte (KB) = (2,048 x 2,048) x 16 / (8 x 1,024) = 8,192 KB

File size in megabyte (MB) = 8,192 / 1,024 = 8 MB

II. File size in kilobyte (KB) = (1,920 x 1,536) x 16 / (8 x 1,024) = 5,780 KB

File size in megabyte (MB) = 5,760 / 1,024 = 5.625 MB