Advertisement

Image file size calculator

An uncompressed bitmap stores a fixed number of bits for every pixel, so its size follows directly from the pixel count and the bit depth. Enter the dimensions and depth to get the raw size, or work backwards from a size limit and a known width. Real JPEG and PNG files are smaller because they compress; this figure is the working buffer or uncompressed maximum.

Calculator

Uncompressed file size
1.5
Bits per pixel
1
Bytes per pixel
0.1250
Total pixels
12,000,000
Megapixels
12.0000
Maximum height in pixels
3,000

Advertisement

How this calculator works

A bitmap image is a grid of pixels, and each pixel carries a fixed number of bits. A 24-bit RGB pixel stores 8 bits each for red, green and blue, which is 3 bytes. Multiplying width by height gives the pixel count, and multiplying that by the bytes per pixel gives the raw file size. A 48-bit image doubles every channel to 16 bits and doubles the file size. This is the uncompressed size: formats such as JPEG, PNG and WebP store patterns more cleverly, so the file on disk is usually smaller, sometimes by a factor of ten or more. Lossless PNG savings depend on the image, while a 24-bit image always occupies the full raw buffer in memory while it is open.

Formula

bytes per pixel = bit depth / 8. uncompressed size (bytes) = width x height x bytes per pixel. For a size limit and a fixed width: height = target bytes / (width x bytes per pixel).

Worked example

A 4000 by 3000 pixel, 24-bit image holds 12,000,000 pixels and stores 3 bytes per pixel, so it needs 36,000,000 bytes, or 36 megabytes in decimal units. The same image at 8 bits per pixel needs 12,000,000 bytes, and at 48 bits per pixel it needs 72,000,000 bytes. If you need a 24-bit image no larger than 36 megapixels of raw storage with a width of 4000 pixels, the maximum height is 36,000,000 / (4000 x 3) = 3000 pixels.

Advertisement

Frequently asked questions

Why is my JPEG much smaller than this figure?

JPEG is a lossy compressor that throws away detail the eye is less likely to notice. The figure here is the raw bitmap size, which is what an editor holds in memory and what an uncompressed format such as TIFF or BMP would write.

What bit depth should I use?

24-bit RGB is the standard for screen images and 8-bit per channel editing. Use 48-bit when you plan heavy colour grading and want to avoid banding, and 1-bit or 8-bit grayscale for line art and masks.

Does the file include metadata?

No. EXIF, colour profiles and thumbnails add bytes on top of the pixel data. For a large image those additions are small, but for a tiny image they can dominate the file.

Are megabytes decimal or binary?

This calculator uses decimal megabytes, where 1 MB is 1,000,000 bytes. Memory and some file managers use binary units, where 1 MiB is 1,048,576 bytes, so the same file can show a smaller number in those tools.

Sources

Advertisement