Delphi 7, load PNG to TImage
Asked Answered
T

6

5

Just want to load a .PNG, tried with my LoadPic() using OleGraphic that works with other formats, but it failed on PNG.

The goal is to copy the image to a hidden bitmap whence it is then masked and copied to a visible working image canvas. Feel free to suggest something else if CopyRect doesn't do this.

But the main question: Load PNG. How? I've found a lot of pages (f.ex. TPNGImage), but all the resources and links on the web are dead, gone or not downloadable.

Teniers answered 4/6, 2011 at 15:44 Comment(4)
can you explain what delphi 7.2 is? I'm not familiar with that version.Lizzettelizzie
Delphi 7.2 is an unauthorised modified version of Delphi 7, usually found on Torrent sites.Fahrenheit
use Gustavo Daud's PNG DelphiWeese
@Bruce: I think you're reporting a quick google result, since you omit sharing features of D7.2, why anyone would extend D7, or why anyone owning a D7 license like me would have wanted such an extended version in 2003. Did you also find all the other versions of Delphi usually found on torrent sites?Teniers
T
6

I will use GraphicEx from Soft Gems for now. Thanks for helpful answers!

Teniers answered 12/6, 2011 at 20:42 Comment(0)
F
11

Delphi 7 doesn't support PNG natively. There are several third party components that will let you add that support. For example, on Torry's site.

Fahrenheit answered 4/6, 2011 at 16:1 Comment(2)
Bruce's link provides you with several options including direct download links for delphi 7 which worked for me when I just tried them.Tonita
After a quick test, Daud's PNGImage recognized neither TPNGImage nor TImage.pngimage.LoadFromFile. Will have a closer look.Teniers
L
6

Recent versions of Delphi support PNG natively, amongst many other enhancements, and you would be well advised to upgrade.

Lizzettelizzie answered 4/6, 2011 at 16:10 Comment(12)
downvote seems harsh. Rather hard for us to advise how to solve problems with 10 year old illicit software that we don't run. Upgrade solves the problem and some.Lizzettelizzie
@David: Don't tease Delphi 7 fans - it is dangerous. I never do it :)Cabal
@Serg Well, I guess I'm just naive, I didn't realise I was entering dangerous territory.....Lizzettelizzie
@user also, there's a lot more than png in the new delphiLizzettelizzie
@David Heffernan, hm, true, my deeper research uncovers what originally it has proprietary license. Its a quite dirty story behind Mr. Daud's library distribution, i should look a dates more carefully, sorry for misinformation. re: lot more - OP's requirement is PNG support, as said above, there are reasons to stay with D7.Weese
@user One imagines that the main reason OP would wish to stay with D7 is that OP downloaded it illegally and doesn't want to pay $150 for XE starter.Lizzettelizzie
@David Heffernan, i'm not much into all this piracy buzz, not tech subject at all.Weese
@user I sell software for my living and so it kind of bugs me when people violate copyrightLizzettelizzie
@David Heffernan, thats a common reason, which i do understand. What i do not understand is why this reason assumes everyone else should be involved in this jihad. I have no interest in neither warez nor copyrasty, because i've got paid for my work.Weese
@user I don't see any jihad here.Lizzettelizzie
@David Heffernan, well, pirated Delphi fact was mentioned twice before i joined, once more than enough to advise concerned users to not submit free consulting to the "thief". Ofc, i've seen much worse. Whatever, licensed D7 Pro copy has flea market price of USD 10..15, not really a big deal to discuss.Weese
@David Heffernan, "OP's requirement is PNG support, as said above, there are reasons to stay with D7" +1, someone maybe downvoted the original answer because it didn't match that statement. Indeed there are, Delphi fans who have bought numerous original versions like me have sadly had to get used to third party extensions over the years. If Borland et al would have kept upgrading to match real world needs I might have bought a license between 2003 and 2009 ;)Teniers
T
6

I will use GraphicEx from Soft Gems for now. Thanks for helpful answers!

Teniers answered 12/6, 2011 at 20:42 Comment(0)
P
3

Download from below...

http://delphi.pjh2.de/articles/graphic/png.php

It is very easy to handle .png images with delphi 7... Just add it into uses... and create a png object...

Permanent answered 4/6, 2011 at 18:11 Comment(4)
Google failed you. Try to download yourself. See? This project is dead^W never been alive.Weese
The Daud sourceforge project "contains no files", it says.Teniers
It's a dead link. Doesn't matter how many times your answer or comments are read or how many times you paste the same dead link.Teniers
1) delphi.pjh2.de/articles/graphic/png.php -> Dead Link -> You Right 2) delphi.pjh2.de/articles/graphic/png.php -> Alive Link -> I right ... simply and clear...Permanent
D
0

The small Open Source SynGdiPlus library is able to load and save gif, tiff and png pictures.

It will call the GdiPlus.dll library, which is available since Windows XP.

It's fast and reliable.

The same unit is able to render any GDI metafile with anti-aliasing: you write on a regular TCanvas, then it's drawn with anti-aliasing using GDI+. Small code change, greater rendering.

Open Source unit, working from Delphi 6 up to XE.

You can download the latest version from http://synopse.info/fossil/finfo?name=SynGdiPlus.pas

Delectate answered 4/6, 2011 at 18:11 Comment(0)
L
0

GraphicEx by Soft Gems has been moved to https://github.com/mike-lischke/GraphicEx

An explaination regarding the move can be found at http://www.soft-gems.net/index.php/libs/43-graphicex-on-github

I added GraphicEx to my Delphi 6 project and it worked out of the box but when I tested it with Delphi 5 it did not.

Regardless, it works well and implements not only PNG images but also many others which are configurable from GraphicConfiguration.inc:

// Pick your preferred image formats here or leave them all enabled. By disabling
// certain formats which are not of interest you can save some memory.
{$define UseLZW}  //patent is out, yay!
{$define SGIGraphic}             // *.bw, *.rgb, *.rgba, *.sgi images are supported
{$define AutodeskGraphic}        // *.cel, *.pic images
{-$define NewTIFFGraphic}            // *.tif, *.tiff images
{$define OldTIFFGraphic}
{$define TargaGraphic}           // *.tga, *.vst, *.icb, *.vda, *.win images
{$define PCXGraphic}             // *.pcx, *.pcc, *.scr images
{$define PCDGraphic}             // *.pcd images
{$define PortableMapGraphic}     // *.ppm, *.pgm, *.pbm images
{$define CUTGraphic}             // *.cut (+ *.pal) images
{$define GIFGraphic}             // *.gif images
{$define RLAGraphic}             // *.rla, *.rpf images
{$define PhotoshopGraphic}       // *.psd, *.pdd images
{$define PaintshopProGraphic}    // *.psp images
{$define PortableNetworkGraphic} // *.png images
{$define EPSGraphic}             // *.eps images
{$define ArtsAndLettersGraphic}  // *.ged images
Lsd answered 13/10, 2016 at 21:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.