ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Animated GIF in ImageEnView
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

bmesser

United Kingdom
224 Posts

Posted - Mar 28 2014 :  12:48:57  Show Profile  Reply
Hi

Thanks to Nigel's wonderful demo I can now produce animated GIF's to my hearts content.

Today I thought I would use a TImageEnView component to display and animate the same GIF's that I create.

I load the GIF after setting the playloop to continuous. I check out how many frames I have and that reports back correctly. I set playing to true but I don't get any animation.

Image.PlayLoop:=True;
Image.IO.LoadFromFileGIF('Test.GIF');
Debug(Format('Images = %d',[Image.IO.Params.ImageCount]));
Image.Playing:=True;

Am I missing a step here?

If I load the same GIF in IrfanView it works correctly and continuously.

I download an animated GIF of the net and it's just the same although it does seem to loop once.

Bruce.

w2m

USA
1990 Posts

Posted - Mar 28 2014 :  13:45:49  Show Profile  Reply
Hi Bruce:

This works nicely here:
procedure TForm1.Play2Click(Sender: TObject);
{ Animinate the GIF in TImageEnView. }
begin
  ImageEnView1.IO.LoadFromFile(AFileName);
  if Play2.Down then
  begin
    ImageEnView1.Playing := True;
    ImageEnView1.PlayLoop := True;
  end
  else
  begin
    ImageEnView1.Playing := False;
    ImageEnView1.PlayLoop := False;
  end;
end;

I think the sequence of your calls may be incorrect. First load the file then set Playing and PlayLoop,

I found that some gif files did not animate when played in TimageEnView, but the same file animated correctly in TImageEnMView in the same application. I have no idea why.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom ImageEn Development
Go to Top of Page

xequte

38607 Posts

Posted - Mar 29 2014 :  02:05:34  Show Profile  Reply
Hi

You might want to try Bill's GIF creation demo too:

http://www.imageen.com/ieforum/topic.asp?TOPIC_ID=1446

It offers more functionality than mine.


Can you post or forward some GIF's that do not animate? I cannot see any reason why your code should be failing.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

w2m

USA
1990 Posts

Posted - Mar 29 2014 :  13:20:20  Show Profile  Reply
Nigel,

Here are two animated gif's that do not animate in TImageEnView. They do animate in TImageEnMView as well as in IFranView.




William Miller
Go to Top of Page

xequte

38607 Posts

Posted - Mar 30 2014 :  17:48:49  Show Profile  Reply
Hi

Animated GIF's, in general, should have a delay interval specified (i.e. not zero), as by the standard zero means to immediately show the next frame. However in practice, browsers assign a default interval to frames without one specified (or that are too fast).

For v5.1.0 we will make TImageEnView assign a default interval of 100ms if one is not specified.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

bmesser

United Kingdom
224 Posts

Posted - Apr 04 2014 :  02:47:17  Show Profile  Reply
Hi

Sorry for the delay in replying. I've put together the simplest two procedure demo and animated GIF's still fail to work in an ImageEnView component using the Fish example from Bill. I can see the frame count, but setting play to true produces nothing.

procedure TForm8.FormCreate(Sender: TObject);
begin
  ImageEnView1.IO.LoadFromFile(Format('%sfish.gif',[GetExePath]));
  ImageEnView1.PlayLoop:=True;

  Button1.Caption:=Format('%d images',[ImageEnView1.IO.Params.ImageCount]);
end;

procedure TForm8.Button1Click(Sender: TObject);
begin
  if ImageEnView1.Playing then
    ImageEnView1.Playing:=False
  else
    ImageEnView1.Playing:=True;
end;




I am using version 5.0.5, but I notice that we now have a version 5.0.6, and so hopefully that'll do the trick.

Bruce.
Go to Top of Page

xequte

38607 Posts

Posted - Apr 04 2014 :  02:49:39  Show Profile  Reply
Hi Bruce

This fix will appear in v5.1.0, which should be ready very shortly.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

bmesser

United Kingdom
224 Posts

Posted - Apr 04 2014 :  10:42:51  Show Profile  Reply
Hi Nigel

Thanks for that!

There's just one comment I have when creating a large animated GIF is that it takes time! I do realise that there is a lot of processing going on, so I wrap my code in "screen.cursor:=crHourGlass" to indicate the application is processing the image, but the cursor fails to appear and it looks like the app has stalled.

I just wonder if there is anyway round that?

Bruce.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Apr 04 2014 :  10:58:28  Show Profile  Reply
You could try creating the GIF in a thread.

With respect to the 'bad' GIF file to fix it all you have to do is set the delay time and save the gif. Once you save it and reload it The gif will play correctly:
procedure TForm1.DelayTime1Change(Sender: TObject);
{ Set the delay time. }
var
  i: Integer;
begin
  { GIF_DelayTime is not used until the file is saved. }
  for i := 0 to ImageEnMView1.ImageCount - 1 do
    ImageEnMView1.MIO.Params[i].GIF_DelayTime := StrToInt(DelayTime1.Text);
end;

You can also fix the gif file by obtaining my gif maker app with source
http://www.imageen.com/ieforum/topic.asp?TOPIC_ID=1446
I will also try to help you with any specific problems with the gif maker should they occur. Creating a threaded gif maker would take some significant time to create the thread and for testing it, but that will not be free.

I will look at your the code that is time consuming if you post it or send it to me and will offer some comments or suggestions for free.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom ImageEn Development
Go to Top of Page

bmesser

United Kingdom
224 Posts

Posted - Apr 06 2014 :  01:11:59  Show Profile  Reply
Bill

I dropped the optimisation process which speeded up the whole creation process and the hourglass cursor seems to work through the whole process now!

Bruce.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: