Efficiency of using PNG and BMP with large files

I wrote a mapping program in Delphi where a user can load a bitmap in the background, which I store in memory. In one case, the user downloaded BMP from 44 MB, but the program was sluggish, and when they printed (I typed the output), they received an Out Of Resources error. I converted BMP to PNG (3 MB) and the program works much better and the print job was successful.

Since PNG has to be expanded to the same size DIB, anyway, why is there a difference in performance / resource? In any case, PNG loading will require more work and memory. What am I missing?

Since there seem to be no obvious answers, I will write a small demo project to continue exploring this.

+8
delphi png bmp graphics
source share
1 answer

The difference is compression.

BMP = raw data as PNG = same source data using lossless compression

This saves more than 1 way in programming circles ...

  • Image loading results in less raw data being loaded into RAM.
  • Then you process less raw data, so you need less resources.

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

44MB x 10 tiles = 440MB

Vs

3 MB x 10 tiles = 30 MB

Printers do not like to distribute massive chunks of data, and all but the more expensive printers, as a rule, prefer to print the entire document at a time (for example, to buffer the entire stream).

So, from your application, the user says โ€œPrintโ€ ... your code then says โ€œright, I'm going to send 10 copies of this,โ€ and the printer starts to โ€œcacheโ€ 440 MB of raw data.

The most common home printers rely on a computer to cache and print what it gave, but a standard office printer will cache and then print a document.

However ... I think this is an optional thing that you can customize (I think it depends on the printer and the printer).

EDIT:

something from the world of game programming:

http://www.gamedev.net/topic/450104-png-vs-bmp/

+1
source share

All Articles