This program is designed to convert scanned 12-lead electrocardiograms into PNG format and a web-friendly image size. It assumes that the electrocardiogram (ECG) is printed with a black line on white paper with a red grid.

The problems this program is designed to solve are (1) an ECG scanned at relatively high resolution (300 to 600 dots per inch) imposes a substantial load on the web browser because it contains about 6 million pixels which may require 18 to 24 MB of RAM to store for display. Also, (2) typical scanners convert a clean paper ECG into a multitude of colors, include green and blue. The resulting file cannot be compressed efficiently because it does not contain as much redundancy, and thus takes more time to transmit over low-speed network connections.

This program approaches these problems by (1) shrinking the image in a way that preserves the signal data as first priority and the grid data as second priority, and (2) cleaning up the color map so that only three colors remain. (As an option, the red grid can be removed so that only two colors remain.) The first step allows an arbitrary integer reduction in the size of the output file, which reduces the memory burden on the user's web browser. The second step usually reduces the output filesize by 90 to 95%, which reduces transmission time proportionately.

The latest version is on

Further information about the program is in the subdirectory ecg2png/docs/en.

The author thanks the kdevelop team for creating kdevelop, which eased considerably the task of making a documented, autoconfigured open-source package.

Lawrence Widman (, October 17, 1999