Home › Photography & 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
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
width_px | integer | px | yes | Image width in pixels. Range: ≥ 1, ≤ 1000000 |
height_px | integer | px | yes | Image height in pixels. Range: ≥ 1, ≤ 1000000 |
bit_depth_per_channel | integer | bit | default 8 | Bits per colour channel: 8 for JPEG/PNG, 12–14 for camera RAW, 16 for TIFF/PNG-16. Range: ≥ 1, ≤ 32 |
channels | integer | default 3 | Colour channels: 1 for greyscale or Bayer RAW, 3 for RGB, 4 for RGBA/CMYK. Range: ≥ 1, ≤ 4 | |
compression_ratio | number | default 1 | Uncompressed 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_count | integer | default 1 | How many images of this size to total. Range: ≥ 1, ≤ 10000000 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
pixels | integer | px | width_px × height_px. |
bits_per_pixel | integer | bit | bit_depth_per_channel × channels. |
uncompressed_bytes | integer | B | pixels × bits per pixel / 8. |
uncompressed_mb | number | MB | Uncompressed bytes / 10⁶ (decimal megabytes, as used on storage labels). |
compressed_mb | number | MB | Uncompressed MB / compression_ratio. |
total_mb | number | MB | File size × image_count. |
total_gb | number | GB | Total MB / 1000. |
images_per_gb | number | How 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
- API:
GET https://tttkmbb.com/api/v1/calculate/image-file-size(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/image-file-size · Markdown: https://tttkmbb.com/photography/image-file-size.md · JSON definition: https://tttkmbb.com/photography/image-file-size.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="image-file-size" - OpenAPI operationId:
estimate_image_file_size - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Wikipedia – Color depth (reference)
- Wikipedia – Raw image format (reference)
- Wikipedia – JPEG (reference)
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
- Data Storage Converter — Convert between MB, MiB, GB and other storage units.
- Video File Size Calculator — File size of video from bitrate and duration.
- Megapixels to Print Size Calculator — Print size the same pixel dimensions allow.