Formula to Calculate the Memory to Store an Image

By C. Taylor

Calculate file size of an image or photograph.
i photo camera image by A74.FR Ben Fontaine from

When you work with digital images, you may wish to know how to calculate the file sizes of the images. Estimating file sizes of the images helps you plan ahead in terms of media, archival disks and RAM memory needed.


[(Height in pixels) x (length in pixels) x (bit depth)] / 8 / 1024 = image size in kilobytes (KB).

For example, for an image that is 640 x 480 pixels with a 24-bit color depth, multiply 640 x 480 x 16 = 7,372,800 bits. To convert to bytes, that figure must be divided by 8, which equals 921,600. To convert to KB, divide the number of bytes by 1024, which equals 900 KB. Larger sizes can be converted to megabytes (MB) by dividing the number of KB by 1024.


If you want your digital image to be a smaller file size, save it in a compressed format, such as a JPG. The resulting size depends upon numerous variables, including compression algorithm, color reductions and compression scale. Compressed files are expanded in RAM memory while being accessed, so this reduced size is a benefit only when storing it in hard drives or memory cards. When a compressed image is opened, it will still take up the same amount of RAM memory as an image that has not been compressed.


Images are frequently measured in inches with an associated DPI (dots per inch) resolution. To obtain the height or length of an image in pixels, the height (or length) need only be multiplied by the DPI.

For example, a 6-inch x 8-inch photo with 300 DPI is calculated by multiplying 6 X 300 and 8 x 300, which equals 1800 x 2400 pixels.