Solved

Load Image question.

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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 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…
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

623 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