What Is a Raster Image File?
A raster image is a grid of individual picture elements called pixels, each storing color and brightness information. When you view a photograph on your monitor or smartphone, you're seeing a raster image rendered from millions of these tiny colored squares. Unlike vector graphics, which use mathematical formulas to define shapes, raster images record explicit data for every pixel position.
The file size of a raster image depends on two factors:
- Spatial dimensions: measured in pixels wide by pixels tall
- Bit depth: the number of bits allocated to describe each pixel's color
Common raster formats include JPEG, PNG, BMP, and TIFF. Without compression, a 1920 × 1080 photograph at 24-bit color depth requires roughly 6.2 megabytes of uncompressed storage.
Calculating Uncompressed Image File Size
File size depends directly on two variables: the total number of pixels and how many bits describe each pixel. Multiply these values to find the uncompressed size in bits.
Total pixels = width (pixels) × height (pixels)
File size (bits) = total pixels × bit depth
File size (bytes) = [total pixels × bit depth] ÷ 8
width (pixels)— Horizontal dimension of the imageheight (pixels)— Vertical dimension of the imagebit depth— Number of bits assigned to each pixel (typically 8 to 64 for color images)
Understanding Bit Depth and Color Information
Bit depth determines how much color information each pixel can store. A single bit can represent only two values (0 or 1), so increasing bit depth exponentially increases the available color palette.
- 1-bit: black and white only (monochrome)
- 8-bit: 256 colors or shades of gray
- 16-bit: 65,536 colors (sometimes called "High Color")
- 24-bit: 16.7 million colors ("True Color", standard for photography)
- 32-bit: 24-bit color plus 8-bit transparency channel (alpha channel)
Professional photography and graphic work typically use 24-bit or 32-bit depth to preserve fine color gradations and subtle tonal transitions. Web graphics often use 8-bit indexed color to minimize file size.
Practical Considerations for Image File Size
When working with digital images, account for these real-world factors that affect storage and workflow.
- Compression changes the equation — Uncompressed file size calculations ignore compression methods like JPEG, PNG deflate, or WebP encoding. Actual stored files are typically 5–50 times smaller depending on the image content and compression settings. Solid-color areas compress dramatically; photographs with random noise compress poorly.
- Resolution affects display, not file size — Screen resolution (72 dpi, 96 dpi, 300 dpi) is metadata about how to print or display an image, but it doesn't change the raw file size calculation. A 1920 × 1080 pixel image at 72 dpi and at 300 dpi occupy identical byte counts if uncompressed—only the physical print size differs.
- Transparency adds overhead — Images with alpha channels (32-bit instead of 24-bit) require an extra 8 bits per pixel for transparency information. If transparency is essential, account for this 33% increase in uncompressed size. Indexed-color formats like GIF use lookup tables instead, offering different compression trade-offs.
- Camera sensors exceed display needs — Modern digital cameras capture 20+ megapixels, far exceeding what typical displays require. Scaling down images to screen resolution (1920 × 1080) before storage or transmission reduces file size proportionally without visible quality loss in most web and social media contexts.
Practical Examples
Example 1: Full HD photograph
A 1920 × 1080 pixel image at 24-bit color contains 2,073,600 pixels. Multiply by 24 bits per pixel: 49,766,400 bits. Divide by 8 to convert to bytes: 6,220,800 bytes (approximately 6.2 MB uncompressed).
Example 2: Web thumbnail
A 200 × 200 pixel thumbnail at 8-bit grayscale is 40,000 pixels × 8 bits = 320,000 bits, or 40 KB uncompressed. Web browsers will apply additional PNG or JPEG compression, reducing this further.
Example 3: Professional print
A 4000 × 3000 pixel image suitable for large-format printing at 32-bit color (with alpha) requires 12 million pixels × 32 bits = 384 million bits, or 48 MB uncompressed. This is why photographers often work with compressed formats like NEF or CR2 during editing.