Solved

Load Image question.

Posted on 2006-06-25
5
201 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
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
When I am typing into a TEdit last word repeats 7 133
Making delphi communicate with a c# service 16 103
Software to generate custom JPGs 12 117
Find and Replace Stream with 0s 8 62
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
It’s easy to embed any of your public Prezi presentations on your website or social network to share with others. Learn how simple it is in this tutorial.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

770 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