Why can a large PNG take far more memory than its file size?

A PNG can look small in your file manager and still strain your browser. Its compressed size hides the full grid of pixels—and the extra copies a converter may need.

Why can a small PNG file need so much memory?

Think of a PNG like a folded map: it packs away neatly, then needs room to open. Decoding unpacks the compressed file into a grid of pixels; an encoder receives those pixels and writes a compressed PNG.

A folded map represents the packed PNG. A Decode arrow leads to an expanded pixel grid. One 8-bit RGBA pixel separates into red, green, blue and alpha, one byte each; a 16-bit RGBA pixel uses two bytes for each value.
RGBA means red, green, blue and alpha (transparency). Sample depth sets how much space each value takes. Sources and method

The grid's width and height determine how many pixels need room. The pixel layout determines what each pixel stores. A large, simple picture can compress into a small file while still needing a full-sized grid when it's opened.

How big is a 3.7 MB PNG once it's opened?

One generated 6000 × 4000 PNG takes about 3.7 MB on disk. Its 8-bit RGBA pixels need 96 MB, before any extra copies an encoder might make.

Compressed file versus opened pixels

Compressed PNG on disk
3.7 MB
Decoded 8-bit RGBA pixels
96.0 MB
The same picture takes far more room as pixels than as a compressed file.

At the same dimensions, storing more values or more bytes per value makes a bigger pixel grid. Compressing the PNG more tightly doesn't change that arithmetic.

At 6000 by 4000 pixels, RGB 8-bit takes 72 MB, RGBA 8-bit takes 96 MB and RGBA 16-bit takes 192 MB. Each row shows the channel bytes that make up one pixel.
Calculated pixel storage at the same width and height; alpha adds transparency data.

Doing it in FluffyBench: check image dimensions before converting

FluffyBench's PNG Converter lets you check an image's dimensions before conversion. Here's a large flower PNG being saved as a smaller picture on your device.

  1. PNG Converter with Choose images ready for a local PNG.
    PNG Converter with Choose images ready for a local PNG.
    Step 1. Choose a PNG from your device.
    1. Choose images opens your file picker.
  2. PNG Converter with a 6000 by 4000 flower PNG loaded, its dimensions and PNG settings button visible.
    PNG Converter with a 6000 by 4000 flower PNG loaded, its dimensions and PNG settings button visible.
    Step 2. Read the loaded PNG's width and height, then open PNG settings.
    1. Read the source dimensions here.
    2. PNG opens the output settings.
  3. PNG settings with Size set to Dimensions, width 1500, height 1000, Keep aspect ratio checked and Batch speed Light.
    PNG settings with Size set to Dimensions, width 1500, height 1000, Keep aspect ratio checked and Batch speed Light.
    Step 3. Size changes the output grid; the source still needs to be decoded. On a computer, Batch speed limits how many jobs run together; Fast uses more memory. Phones manage batch speed automatically.
    1. Dimensions lets you set the output width and height.
    2. Use 1500 by 1000 for this illustration; keep the aspect ratio.
    3. Choose Light to limit simultaneous jobs in a batch.
  4. PNG settings closed with Convert 1 to PNG ready.
    PNG settings closed with Convert 1 to PNG ready.
    Step 4. Close settings with the PNG button, then convert.
    1. PNG also closes the settings.
    2. Convert writes the smaller PNG.
  5. Completed flower PNG with source and output dimensions, file sizes and Download.
    Completed flower PNG with source and output dimensions, file sizes and Download.
    Step 5. Check the output dimensions and file size on the completed tile, then save the PNG.
    1. Read the output dimensions and PNG file size here.
    2. Download saves the PNG to your device.

How FluffyBench's PNG encoder now avoids extra pixel copies

FluffyBench's PNG encoder now skips a temporary grid that widened every 8-bit input value to two bytes; writing 8-bit RGBA also reuses the input pixels, removing a second copy. These are calculated buffer sizes for the RGBA case; compression and output need their own memory.

Old path: 96 MB input, 192 MB widened samples, 96 MB copied raster, then compression. Updated path: the same input goes straight to compression. The removed buffers total 288 MB.
The old 8-bit RGBA path added two temporary buffers; the updated path reuses the input grid.

In the measured noisy RGBA image, the update almost halved peak image-buffer memory. The RGB image used less memory too, even though writing RGB still needs a separate output grid.

Peak image-buffer memory: old → updated

24-megapixel RGBA 8-bit, noisy · old
549.1 MiB
24-megapixel RGBA 8-bit, noisy · updated
274.5 MiB
24-megapixel RGBA 8-bit, flat · old
460.4 MiB
24-megapixel RGBA 8-bit, flat · updated
185.7 MiB
12-megapixel RGB 8-bit, noisy · old
272 MiB
12-megapixel RGB 8-bit, noisy · updated
144 MiB
Peak image-buffer memory for generated noisy and flat pictures, measured outside the browser.
Search FluffyBench