Solved

Load Image question.

Posted on 2006-06-25
5
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
Scay7 earned 250 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Many programs have tried to outwit PowerPoint in terms of technology and skill. These programs, however, still lack several characteristics that PowerPoint has possessed from the start. Here's why PowerPoint replacements won't entirely work for desi…
Add visuals to your Prezi to keep your audience engaged. Learn how to embed images, edit them, and more in this video micro tutorial. Select "Insert" from the top menu in your Prezi editor: Select "Image": A toolbar will pop in from the right …
Learn how to download your full Prezi presentation for offline presenting. Prezi doesn’t have to be viewed and shared in a web browser, even with a free account you can download your full presentation to share with others. Be sure to download any vi…

752 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