Efficiency of Using PNG's vs. BMP's With Large Files

I've written a mapping program in Delphi where the user can load a raster image in the background which I store in memory. In one case the user loaded a 44MB BMP successfully but the program was sluggish and when they printed (I tile the output) they got an Out Of Resources error. I converted the BMP to a PNG (3MB) and the program performs much better and the print job was successful.

Since the PNG has to be expanded to a DIB of the same size anyway why is there a performance/resource difference? If anything it should take more work and memory allocations to load the PNG. What am I missing?

Since there don't seem to be any obvious answers I'll write a small demo project so I can research this further.


The difference is compression.

BMP = raw data as is PNG = same raw data using "lossless" compression

This has a saving in more than 1 way in programming circles ...

  1. loading the image results in loading less raw data in to ram.
  2. You are then processing less raw data so you need less resource.

Tiling means the problem for you is exponential for example ...

44MB x 10 tiles = 440MB


3MB x 10 tiles = 30MB

Printers don't like being handed massive chunks of data and all but the more expensive printers tend to like to print and entire document in one go (eg buffer the whole stream).

So from your app the user says "Print" ... your code then says "right i'm gonna send 10 copies of this" and the printer starts "caching" 440MB of raw data.

Most common home printers rely on the pc to do the caching and print what it's given but a standard office printer will do the caching then print the doc.

However ... i think this is an optional thing you can tweak (i'm thinking it varies from printer to printer though).


heres something from the world of game programming:


Need Your Help

Flowing from a thin client (web browser) to an installed and running application

java web-applications legacy-code thick-client thin-client

So I am working an a large scale application. We are in the process of moving from an installed java application to a web based application. During the transition release(s) we need the ability to ...

JS/Jquery, Match not finding the PNG = match('/gif|jpg|jpeg|png/')

javascript jquery regex match

I have the following code which I use to match fancybox possible elements: