Recent

Author Topic: How to display a GIF file in a TImage?  (Read 9182 times)

tech-pro

  • Full Member
  • ***
  • Posts: 173
    • Tech-Pro.net
How to display a GIF file in a TImage?
« on: November 28, 2008, 12:47:39 am »
What's the best way to display a GIF file in a Lazarus program?

I had a program that used OPBitmap that displayed GIF images. But the version of OPBitmap I had did not compile with 0.9.26. I downloaded the latest version of OPBitmap and compiled that, but now GIF files are treated as an unknown format. What to do?

I'm not sure if OPBitmap is the best thing to use anyway. Is it cross-platform? I have only ever used it under Windows but I want this program to work under Linux as well.
Julian

Leledumbo

  • Hero Member
  • *****
  • Posts: 8819
  • Programming + Glam Metal + Tae Kwon Do = Me
RE: How to display a GIF file in a TImage?
« Reply #1 on: November 28, 2008, 04:13:58 am »
There are some components (try latest version, if it doesn't work, try downgrading) named TGIFImage here, I've checked the source and it seems possible to compile under Lazarus with a little modification. Like deleting CompareMem and replacing ReturnAddr with ExceptAddr as FreePascal already implements them in a cross-platform nature.

tech-pro

  • Full Member
  • ***
  • Posts: 173
    • Tech-Pro.net
RE: How to display a GIF file in a TImage?
« Reply #2 on: November 28, 2008, 11:41:15 am »
Thanks. It won't be necessary as I found a new example that loads a GIF into a TImage via a TLazOPPicture which solved the problem. However I'd still be interested to know why loading it directly into the TImage after simply adding fpimage and opbitmapformats to the Uses clause no longer works, as it originally did in the lclintegration demo example.

I just verified that OPBitmap works in Linux too. :) Lazarus is brilliant!!
Julian

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1932
RE: How to display a GIF file in a TImage?
« Reply #3 on: November 28, 2008, 12:00:57 pm »
Humm, the lclintegrationdemo works for me. Make sure that the unit "RegisterLazOp" is in the uses clause somewhere.
OpBitmap works on Linux and Windows (32bit). It basically works on 64 bit except the readers ported from GraphicEx which contain tons of Intel ASM.
GIF R/W for example should work on 64 bit. I have never tested it on a Mac.

 

TinyPortal © 2005-2018