January 14, 2008

Handbook Note 78/113: PNG Graphic Format

Note 78 of 113 of Delphi 2007 Handbook

Note 78: Support for the PNG format in Delphi is available using the free PNG Components (http://www.thany.org/article/32/PngComponents). This library has even a custom ImageList that makes PNG images available to buttons, menu items, and the like.

This blog post is part of my "113 Delphi 2007 Handbook Notes" blogging project, to promote my new Delphi book.

Update (Jan 14th)

As some blog readers pointed out (see below) the URL changed to http://www.thany.org/article/18/Delphi_components and these PNG components seem not to be in a very good shape. Alternative proposals?





 

12 Comments

Handbook Note 78/113 PNG Graphic Format 

That link's broken!

Probably because PngComponents are discontinued and
out of sync with the latest TPNGDelphi components.
I've had installation issues with these in RADStudio
2007 - sounds like a good idea to get these in
sourceforge in some form.
Comment by Roddy on January 14, 13:12

Handbook Note 78/113 PNG Graphic Format 

The components have been discontinued. The link you 
provided is broken. See the internet archive for an 
older version of the page
http://web.archive.org/web/20070528013220/
www.thany.org/article/32/PngComponents

and this page for download:
http://www.thany.org/article/18/Delphi_components
Comment by Thomas Mueller [http://www.dummzeuch.de] on January 14, 13:20

Handbook Note 78/113 PNG Graphic Format 

Seems to have been pulled. Page is empty, title just
says "Thany.org - null"
Comment by delphi guy on January 14, 13:23

Handbook Note 78/113 PNG Graphic Format 

PngComponents are built using PNGDelphi (which in turn
uses ZLib), so if you just want simple PNG stuff, you
can use that. But I love TPngImagelist too much... 
Comment by Roddy on January 14, 14:22

Handbook Note 78/113 PNG Graphic Format 

They might be discontinued, but all works like a charm
for me with D2007. Nevertheless, as pointed out
before,  the installation wasn't really easy.
Comment by Adrien Reboisson on January 14, 14:34

Handbook Note 78/113 PNG Graphic Format 

Another Delphi component for PNG is pngdelphi.
I have used PNG Delphi from SourceForge
http://pngdelphi.sourceforge.net/

Latest version is from August 2006, so fairly up to 
date.
pngdelphi compiles with Delphi 2007 on XP and Vista.

Regards


martinalex
Comment by martinalex [http://tagosphere.blogspot.com/] on January 14, 14:47

Handbook Note 78/113 PNG Graphic Format 

Thanks to all of you for the feedback.
Comment by Marco Cantù [http://www.marcocantu.com] on January 14, 16:38

Handbook Note 78/113 PNG Graphic Format 

 But what is better: PNG or JPG ? what is lighter and 
faster to use ? 
Comment by JL on January 15, 12:19

Handbook Note 78/113 PNG Graphic Format 

 They are two different animals. PNG is for graphics
(like gif) and jpeg is for photos and the like. Google
the formats for more info.
Comment by on January 15, 15:04

Handbook Note 78/113 PNG Graphic Format 

"JPEG is for photos" only because it can achieve 
better compression due to its lossy compression 
algorithm, and therefore useful to shorten downloads 
time and storage space used.
PNG uses a lossless algorithm and thereby leads to 
larger files, although it yelds better result when 
the image contains also text and other graphical 
items - where JPEG can introduce artifacts.
JPEG is also not suitable if the image needs further 
manipulation. That's why, for example, TIFF or 
proprietary formats like PSD are used professionaly, 
or advanced cameras export data in RAW format and not 
JPEG. While PNG could be used, it was designed 
with "the internet" in mind, and lacks some advanced 
features, i.e. supporting color spaces different from 
RGB, or the EXIF data.
The proper file format for an image file has to be 
selected considering the image to be stored, and its 
use.
That said, because Vista icons uses a PNG compressed 
format, I guess Delphi should support PNG natively, 
it's time...
Comment by Luigi D. Sandon on January 15, 15:48

Handbook Note 78/113 PNG Graphic Format 

Hi, I found a simple method for compiling Thany PNG
components with Delphi 2007.

Just add this code to Thany.inc file over IFDEF VER170:

{$IFDEF VER180}
  {$DEFINE THANY_COMPILER_9}
  {$IFDEF BCB}
    {$DEFINE THANY_CPPB}
    {$DEFINE THANY_CPPB_9}
  {$ELSE}
    {$DEFINE THANY_DELPHI}
    {$DEFINE THANY_DELPHI_9}
  {$ENDIF}
{$ENDIF} 

Leonardo.
Comment by Leonardo M. Ramé [http://leonardorame.blogspot.com] on July 16, 16:46

Handbook Note 78/113 PNG Graphic Format 

Thanks much, Leonardo. Worked very well! :) 
Comment by BangMan on November 15, 15:41


Post Your Comment

Click here for posting your feedback to this blog.

There are currently 0 pending (unapproved) messages.