HomePhotography & Optics › Image File Size Calculator

Image File Size Calculator

Estimates the storage size of an image from its pixel dimensions, bits per channel, number of channels and a compression ratio, and scales the result to a number of images, in decimal megabytes and gigabytes.

When to use

You need to estimate how much space photos, scans or RAW files take, or how many images fit on a memory card or drive.

Do not use when: You need a video's file size from bitrate (use video-file-size) or a print size from megapixels (use megapixels-print-size).

Formula

uncompressed_bytes = width_px × height_px × bit_depth_per_channel × channels / 8; compressed_mb = uncompressed_bytes / 10⁶ / compression_ratio; total_gb = compressed_mb × image_count / 1000

Pixel data only: real files add headers, metadata and embedded previews (RAW files carry a JPEG preview of several MB), and lossy compression ratios vary with image content by a factor of 2 or more. 1 MB = 1 000 000 bytes; binary MiB values are 4.9 % smaller.

Inputs

ParameterTypeUnitRequiredDescription
width_pxintegerpxyesImage width in pixels. Range: ≥ 1, ≤ 1000000
height_pxintegerpxyesImage height in pixels. Range: ≥ 1, ≤ 1000000
bit_depth_per_channelintegerbitdefault 8Bits per colour channel: 8 for JPEG/PNG, 12–14 for camera RAW, 16 for TIFF/PNG-16. Range: ≥ 1, ≤ 32
channelsintegerdefault 3Colour channels: 1 for greyscale or Bayer RAW, 3 for RGB, 4 for RGBA/CMYK. Range: ≥ 1, ≤ 4
compression_rationumberdefault 1Uncompressed size ÷ file size: 1 for uncompressed TIFF/BMP, about 2 for lossless RAW/PNG, 5–8 for JPEG at highest quality, 10 for JPEG quality ~90, 20+ for web JPEGs. Range: ≥ 1, ≤ 1000
image_countintegerdefault 1How many images of this size to total. Range: ≥ 1, ≤ 10000000

Outputs

OutputTypeUnitDescription
pixelsintegerpxwidth_px × height_px.
bits_per_pixelintegerbitbit_depth_per_channel × channels.
uncompressed_bytesintegerBpixels × bits per pixel / 8.
uncompressed_mbnumberMBUncompressed bytes / 10⁶ (decimal megabytes, as used on storage labels).
compressed_mbnumberMBUncompressed MB / compression_ratio.
total_mbnumberMBFile size × image_count.
total_gbnumberGBTotal MB / 1000.
images_per_gbnumberHow many files of this size fit in one decimal gigabyte.

Example

24 MP 8-bit RGB, JPEG at ratio 10, 100 images: {"width_px":6000,"height_px":4000,"bit_depth_per_channel":8,"channels":3,"compression_ratio":10,"image_count":100}{"pixels":24000000,"uncompressed_bytes":72000000,"uncompressed_mb":72,"compressed_mb":7.2,"total_gb":0.72,"images_per_gb":139}

24 MP 14-bit uncompressed RAW (one Bayer channel): {"width_px":6000,"height_px":4000,"bit_depth_per_channel":14,"channels":1}{"bits_per_pixel":14,"uncompressed_bytes":42000000,"uncompressed_mb":42,"total_mb":42}

GET https://tttkmbb.com/api/v1/calculate/image-file-size?width_px=6000&height_px=4000&bit_depth_per_channel=8&channels=3&compression_ratio=10&image_count=100

Machine access

Sources

FAQ

Why is a RAW file counted with one channel?

A Bayer sensor records one colour sample per pixel (12 or 14 bits); the three RGB channels are only created when the RAW is demosaiced. Lossless RAW compression then roughly halves the file.

What compression ratio should I use for JPEG?

Camera JPEGs at highest quality are typically 5–8× smaller than uncompressed 8-bit RGB (a 24 MP JPEG is 9–14 MB); quality 90 gives about 10×, and web-optimised images 20× or more.

Related calculators