Recent

Author Topic: how to load gif image  (Read 1940 times)

__thinhorigami

  • Newbie
  • Posts: 3
how to load gif image
« on: October 08, 2021, 01:59:15 pm »
Hi all,
I have a question.
is there a way to get the gif file?
and i have an idea to make a gif art, i can do it if its just an image. but what should i do if it's a gif. I need some help.
thanks all

wp

  • Hero Member
  • *****
  • Posts: 9021
Re: how to load gif image
« Reply #1 on: October 08, 2021, 04:24:51 pm »
I don't fully understand what you are trying to achieve. Load a gif file and display it on a Lazarus form? For this, add unit fpreadgif to "uses" and call Image1.Picture.LoadFromFile(name_of_gif_file) for an image on the form. However, this does not support animated gifs and has some more drawbacks. For a complete gif viewer you can install GifAnim or GifViewer from the online-package-manager.

If you are trying to write a gif you'll have to live with little support here. GifAnim and GifViewer do not support writing at all. There is a tweak to provide a unit fpwritegif for fcl - search the forum, it was recently discussed -, but this is not for animated images.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

circular

  • Hero Member
  • *****
  • Posts: 3744
    • Personal webpage
Re: how to load gif image
« Reply #2 on: October 10, 2021, 02:16:16 pm »
You can make Gif using BGRABitmap's TBGRAAnimatedGif:
https://github.com/bgrabitmap/bgrabitmap/blob/master/bgrabitmap/bgraanimatedgif.pas

Create an empty gif, call SetSize and add frames. There are various methods. The simplest is to call AddFullFrame for each frame.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018