Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Load Image question.

Posted on 2006-06-25
5
Medium Priority
?
207 Views
Last Modified: 2013-11-19
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.
0
Comment
Question by:crystyan
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
Scay7 earned 1000 total points
ID: 16978342
Which version of delphi are you using?
this gif that you are trying to load, does it have multiple frames (moving gif).
did you checkout "TAnimate" just search for it in delphi help files.

TImage usualy only handles *.BMP files unless you include JPEG in you uses which TImage can then handle JPG/JPEG/BMP/ICO/EMF/WMF

Alternatively you can check this out:
http://delphi.about.com/od/graphics/a/delphigif.htm

scroll down to TGIFImage[2] (free for non-comercial use)

or

scroll down to GraphicEx image library (can only load images of many formats, not save)
this is also a replacement for the graphics.pas which comes standard with delphi

Basicly, TImage wasnt designed for GIFS, or so i was lead to believe... :P

Hope this helps in some way

Peace Scay7
PS id go for GraphicEx image library, if your just loading the images and not saving them...
0
 

Author Comment

by:crystyan
ID: 16978355
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?
0
 
LVL 5

Expert Comment

by:Scay7
ID: 16978400
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

0
 

Author Comment

by:crystyan
ID: 16978784
Hi,

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

THANKS and sorry for missunderstanding!
0
 
LVL 5

Expert Comment

by:Scay7
ID: 16988262
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
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Keep your audience engaged and get the most out of your next presentation with these quick Prezi tips.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
In this tutorial viewers will learn how to create blended and gradiated shapes in Illustrator using the blend tool Draw two shapes, one of them in a different color: Select both and create a blend by going to Object > Blend > Make: Blends can also b…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question