[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 830
  • Last Modified:

PNG Components

Hi, ive installed PNGComponents, and it doesnt let me load a file into timage called PNG. It only allows JPG, ico.. but no PNG.

How do i get PNG to load into the program im making at design time. The same way the timage normally works with a bmp.
0
966
Asked:
966
  • 5
  • 2
1 Solution
 
epasquierCommented:
if you are using the same componnent that I'm using, there is a code line responsible for that at the end of pngimage.pas in the initialization section :

  {$IFDEF UseDelphi}{$IFDEF RegisterGraphic}
    TPicture.RegisterFileFormat('PNG', 'Portable Network Graphics', TPNGObject);
  {$ENDIF}{$ENDIF}

which register the PNG file format in the TPicture class. Make sure you add this pngImage in the uses of your project, and check in debug that this line is compiled (there could be a pb with conditional defines) & executed. If not, then maybe it's because you have added the unit in your project (not only in the uses) and it is therefore recompiled without the UseDelphi & RegisterGraphic conditionals.
either remove it from the project, or add the conditionals in your project (which is not the best option, but could help you moving on before fixing properly)
0
 
966Author Commented:
Thanks for the help. I used an auto installer that was a .exe that did it all for me. Ive added pngimage in uses, but i still cannt have the option to import the png in, its dam odd.
0
 
966Author Commented:
is there some code i have to type, or should it work the same way as timage? Like.. when i drop an image on a delphi form, and select picture props and i should be able to browse a PNG right?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
epasquierCommented:
this is the one I use :
PngComponents 1.0 RC3
http://www.thany.org/article/18/VCL

You have to install the package found in \Delphi : PNG_D?.dpk
This will automatically register the format for all TPicture

I suppose you are using TOpenPictureDialog , if you delete the component and re-add it, you will see *.png in the filter
0
 
966Author Commented:
im using the same one. i did a search for PNG_D>.pdk it cant find it on my computer anywhere. where is it located \delphi ??  so you think if i reinstall the whole pngcomponents it will work maybe?
0
 
966Author Commented:
yeah ur right mate, i reinstall did the trick. I checked that line of code in the section and this time it compiled. cheers mate, ur a star
0
 
966Author Commented:
Great!
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now