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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Animated GIF slow loading

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
FabCob Posted - Jan 25 2022 : 05:49:36
Hello,

I use TcxImage (Devexpress) to load animated GIF and it's work fine.
I would like to migrate to ImageEn component but compared to Tcximage it is very very slow to load animated GIF.
For the moment I only want to show animation = Readonly without any interaction.
I have tried both TImageEn and TImageEnView component.

Loaded like this :

ImageEnView1.io.LoadFromFileGIF('c:\MyAnimatedPicture.gif');

or

ImageEnView1.LockUpdate;
try
 ImageEnView1.io.LoadFromFileGIF('c:\MyAnimatedPicture.gif');
finally
  ImageEnView1.UnLockUpdate;
end;


I have tried to change some properties but nothing has improved speed of loading. But there is a lot of properties. Or maybe it is because Imageen is oriented image editing ?
I'am sure that is exist a way to speed up loading of animated GIF !

Any suggestion ?

I use ImageEn version 10.0.0.0 with Delphi 10.3.3.
9   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jan 28 2022 : 17:08:08
Hi

Please email me for a source update that supports more GIF frame caching options.

Nigel
Xequte Software
www.imageen.com
FabCob Posted - Jan 28 2022 : 03:31:55
Hello,

I have just update to 10.3.

Now the first loading take same time as DevExpress Tcximage but the next loadings are very long.

So I have tried to add "ImageEnView1.playing:=false;" without any changed in time loading :

procedure TForm18.b_TImageEnViewClick(Sender: TObject);
var
  LStopWatch:TstopWatch;
  cnt:integer;
begin
  LStopWatch.Reset;
  LStopWatch.Start;

  if ImageEnView1.playing then
    ImageEnView1.playing:=false;
  ImageEnView1.IO.LoadFromFileGIF(ReturnGifFileName);
  if not ImageEnView1.playing then
    ImageEnView1.playing:=True;
  LStopWatch.Stop;

  Edit2.text:=LStopWatch.ElapsedMilliseconds.tostring+' ms';

end;


Same with :
procedure TForm18.b_TImageEnViewClick(Sender: TObject);
var
  LStopWatch:TstopWatch;
  cnt:integer;
begin
  LStopWatch.Reset;
  LStopWatch.Start;
  ImageEnView1.LockUpdate;
  if ImageEnView1.playing then
    ImageEnView1.playing:=false;
  ImageEnView1.IO.LoadFromFileGIF(ReturnGifFileName);
  if not ImageEnView1.playing then
    ImageEnView1.playing:=True;
  ImageEnView1.UnLockUpdate;
  LStopWatch.Stop;

  Edit2.text:=LStopWatch.ElapsedMilliseconds.tostring+' ms';

end;



Same with :
procedure TForm18.b_TImageEnViewClick(Sender: TObject);
var
  LStopWatch:TstopWatch;
  cnt:integer;
begin
  LStopWatch.Reset;
  LStopWatch.Start;
 // ImageEnView1.LockUpdate;
  if ImageEnView1.playing then
    ImageEnView1.playing:=false;
  ImageEnView1.Clear;
  ImageEnView1.IO.LoadFromFileGIF(ReturnGifFileName);
  if not ImageEnView1.playing then
    ImageEnView1.playing:=True;
  //ImageEnView1.UnLockUpdate;
  LStopWatch.Stop;

  Edit2.text:=LStopWatch.ElapsedMilliseconds.tostring+' ms';

end;


It's take more time each time I click on my button ...
FabCob Posted - Jan 28 2022 : 01:56:59
Hi,

I use :
ImageEn 10.0.0 (11 April 2021)
xequte Posted - Jan 27 2022 : 15:05:20
Hi

What version of ImageEn are you using? If animating from frame 0, the first and each subsequent frame should only take <100ms

Nigel
Xequte Software
www.imageen.com
FabCob Posted - Jan 27 2022 : 03:01:23
Hello Nigel,

Thank you for your quick answer.

My purpose is only to load and play a animated GIF.
In my software, at login time like on Windows, my end user can choose them photo but it can be an animated GIF. So I only need the quicker loading. 7 s it to long when it's take only 15 ms with Devexpress TcxImage !


So I will wait your next release to test it.
xequte Posted - Jan 26 2022 : 23:18:33
For the next release we have also added an all frames option to cache all frames of the GIF file in memory. It is slow for the first load, but all subsequent frame loads will be instantaneous.

You would only use that option if you need to access the frames in a non-consecutive order (accessing them randomly or playing the frames backwards, for example).

// General usage to speed up loading of GIF frames
ImageEnView1.IO.GIFFrameCaching := iefcAlways;
cnt := IEGetFileFramesCount( GetGifFilename() );
for i := 0 to cnt - 1 do
begin
  ImageEnView1.IO.GIF_ImageIndex := i;
  ImageEnView1.IO.LoadFromFileGIF( GetGifFilename() );
  ImageEnView1.IO.PrintImage();
end;

// Caching of all frames so that we can access random frames very quickly (initial load is slower, and uses more memory)
ImageEnView1.IO.GIFFrameCaching := iefcAllFrames;
ImageEnView1.IO.GIF_ImageIndex := idx;
ImageEnView1.IO.LoadFromFileGIF( GetGifFilename() );


Nigel
Xequte Software
www.imageen.com
xequte Posted - Jan 26 2022 : 22:51:55
OK, so the issue here is one of GIF merging.

Loading a single frame with ImageEn is fast, e.g. loading frame 0 is four times faster than TImage (I don't have DevExpress).




But if you need to load the 100th frame, for example, then all 99 frames before the frame we want must be loaded to ensure we have the correct content for frame 100 (as the frame is generally a merge of all the ones before it).

So the way around that is caching. ImageEn caches the previous frame so that the next frame can be loaded extra quickly. At present it only does this when seeking or playing frames, but we will add a GIFCaching property to TImageEnIO in the next update.

You can email us for it if you like.

Nigel
Xequte Software
www.imageen.com
FabCob Posted - Jan 26 2022 : 11:01:46
Hello,


See in attachment full source and TcxImage is 500 times quicker than TImageEnView (at first loading) !




Only with this code :
procedure TForm18.b_TImageEnViewClick(Sender: TObject);
var
  LStopWatch:TstopWatch;
begin
  LStopWatch.Reset;
  LStopWatch.Start;
  ImageEnView1.IO.LoadFromFileGIF(ReturnGifFileName);
  LStopWatch.Stop;

  Edit2.text:=LStopWatch.ElapsedMilliseconds.tostring+' ms';

end;

function TForm18.ReturnGifFileName:TFilename;
begin
  result:= tpath.Combine( ExtractFilePath(paramstr(0)),ANIMATED_GIF_FILENAME);
end;

procedure TForm18.b_TcxImageClick(Sender: TObject);
var
  LStopWatch:TstopWatch;
begin
  LStopWatch.Reset;
  LStopWatch.Start;
  cxImage1.Picture.LoadFromFile(ReturnGifFileName);
  LStopWatch.Stop;

  Edit1.text:=LStopWatch.ElapsedMilliseconds.tostring+' ms';

end;







attach/FabCob/2022126105920_AnimatedGif.zip
3681.35 KB



Download Attachment: 2022126105920_AnimatedGif.zip
xequte Posted - Jan 25 2022 : 16:47:26
Hi

In our tests, we have found our GIF loading to be comparable to other libraries (e.g. essentially the same as loading via Windows Imaging Component). Is it the loading itself that you are saying is slow, i.e. have you put the performance timer around the LoadFromFileGIF() call?

Nigel
Xequte Software
www.imageen.com