Link to home
Start Free TrialLog in
Avatar of crystyan
crystyan

asked on

Load Image question.

I have a problem loading an image in a TImage from the code. For example if the TImage is empty and I try to do a LoadFromFile(gifimage) it throws me that it doesn`t know .gif. If I load a gif image using the editor, then LoadFromFile(gifimage) it works! It happens for all the extensions.
ASKER CERTIFIED SOLUTION
Avatar of Scay7
Scay7
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of crystyan
crystyan

ASKER

I think u didn`t understand. I have a component wich overloaded TImage and I can load .GIF, .PNG, etc...
The problem is that I can load them from the designer anytime. Let`s say I load a .PNG image from the editor then in the object inspector in the picture field it says TPNGOBJECT and I have the png loaded. After this I can load from my code any png with np. BUT if I don`t load any png image from the editor and the Picture field is empty I can`t load an image from code.

Does it make sence?
Okay so you already have a component, you never mentioned that in your first post ;0

K so you load a png with editor at design
run the program
now you can load any png with code

but

leave image blank
run program
now you cant load a png with code?

K so im guessing that the problem lies with this component that you have (is this the first time its happening?)

Try loading a standard BMP with that component, if it works... 1 of 2 things might be wrong
1. the code for that component doesnt work so well...
2. the gif(animated) or png has properties that the component cant handle when compiled, cause delphi has a debugger
(these are guesses, i dont know which component your using)

Again which version of delphi you using ?
and try that GraphicEx image library that i mentioned it also loads png and gif using the standard TImage

Hi,

I`m using Delphi 7. and GraphixEx works GREAT!!

THANKS and sorry for missunderstanding!
Np man

Another thing D7 comes standard with the JPEG unit, so mabey you can change those GIFS/PNG's to JPEG's and not have to load the extra unit. This can reduce the size of the app, unless app size doesnt matter.
Either way glad to be of assistance :PP

Peace Scay7