# 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.

- Calculator id: `image-file-size` · Category: Photography & Optics (`photography`) · Tool name: `estimate_image_file_size`
- Canonical page: https://tttkmbb.com/photography/image-file-size · This document: https://tttkmbb.com/photography/image-file-size.md · JSON definition: https://tttkmbb.com/photography/image-file-size.json

## Purpose

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.

**Use when:** 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).

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `width_px` | integer | px | required | Image width in pixels. (min 1, max 1000000) |
| `height_px` | integer | px | required | Image height in pixels. (min 1, max 1000000) |
| `bit_depth_per_channel` | integer | bit | optional, default 8 | Bits per colour channel: 8 for JPEG/PNG, 12–14 for camera RAW, 16 for TIFF/PNG-16. (min 1, max 32) |
| `channels` | integer |  | optional, default 3 | Colour channels: 1 for greyscale or Bayer RAW, 3 for RGB, 4 for RGBA/CMYK. (min 1, max 4) |
| `compression_ratio` | number |  | optional, 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. (min 1, max 1000) |
| `image_count` | integer |  | optional, default 1 | How many images of this size to total. (min 1, max 10000000) |

## Output

| Field | 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. |

## 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.

## Data Sources

- Wikipedia – Color depth — https://en.wikipedia.org/wiki/Color_depth (reference, retrieved 2026-09-24)
- Wikipedia – Raw image format — https://en.wikipedia.org/wiki/Raw_image_format (reference, retrieved 2026-09-24)
- Wikipedia – JPEG — https://en.wikipedia.org/wiki/JPEG (reference, retrieved 2026-09-24)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/image-file-size?width_px=…&height_px=…`
- `POST https://tttkmbb.com/api/v1/calculate/image-file-size` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/image-file-size · OpenAPI operationId `estimate_image_file_size` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "image-file-size", "inputs": {…}}`

## Example

- 24 MP 8-bit RGB, JPEG at ratio 10, 100 images: inputs `{"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): inputs `{"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
```

## Limitations

You need a video's file size from bitrate (use video-file-size) or a print size from megapixels (use megapixels-print-size). 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. All values are computed from the formula above; no measurement or live data is involved.

## 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

- [Data Storage Converter](https://tttkmbb.com/conversion/data-storage.md) — Convert between MB, MiB, GB and other storage units.
- [Video File Size Calculator](https://tttkmbb.com/everyday/video-file-size.md) — File size of video from bitrate and duration.
- [Megapixels to Print Size Calculator](https://tttkmbb.com/photography/megapixels-print-size.md) — Print size the same pixel dimensions allow.
