Solved

Load Image question.

Posted on 2006-06-25
5
199 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 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Hi,

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

THANKS and sorry for missunderstanding!
0
 
LVL 5

Expert Comment

by:Scay7
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this Micro Tutorial viewers will learn the basic shortcuts and functions of Illustrator. The viewer will learn about the paintbrush tool, anchor points, font sizing, and more.
Learn how to use the remote presentation tool in Prezi to allow you to harness the power of this cloud based presentation platform. You can show your presentation with a remote audience using this free tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now