Delphi - PNG Images

For web pages, images are typically in either jpeg or png format. The image editor supplied with Delphi 5 does not supply either of those. Windows Paint provides both. I eventually got tired of using Windows Paint to document my programs .. so I wrote my own screen capture utility.

Delphi 5 provides a unit to create jpeg files, but not png. (More recent versions contain png support.)

This page discusses using

in Delphi 5 to provide png support.

Overview | Save PNG File | A Test Case


Overview

Several forums suggest using TPNGImage by Gustavo Daud but claim that it is no longer available on sourceforge. It turns out that as of June 2014, they are correct. Luckily, I found part of it available on Torry's Delphi page. The comments indicate that it works with D2005 D2006 D2007 D6 D7, but not Delphi 5 (D5) .. so I took a chance. The zip contains source code, a few object files, and a help file.

The help file says that there is one package file per Delphi version .. and to use the correct one. Well, there aren't any package files! So I created one.

That's all there is to it. There will be a new "button" added to the Samples tab - but it just has a default icon since there was no resource file in the zip. (The code example in the next section does not use this.)


Save PNG File

This is the code I used - no big deal. It works using Delphi 5 on Windows XP.


A Test Case

Using a single image, these are the file sizes I was not able to detect any visual difference between the files.


Author: Robert Clemenzi
URL: http:// mc-computing.com / Languages / Delphi / PNG_Images.html