Author |
Topic  |
|
PeterPanino
   
951 Posts |
Posted - May 23 2021 : 08:35:12
|
Please look at this demo:
\ImageEn\Demos\InputOutput\IEViewMulti\
The code provides TWO methods to select and display a specific frame:
// METHOD 1: SET IMAGEINDEX and RELOAD
However, by reloading the image, we LOSE any changes we have made in the image!
// METHOD 2: USE IO.SEEK
However, this method's only options are to go to the next, previous, first, or last frame. There is no parameter to select a specific frame.
So how can I show a specific frame in a multi-frame image? For example, if a GIF contains 150 frames and I want to select frame #99 without losing any changes I have made, how can I do that? |
|
PeterPanino
   
951 Posts |
Posted - May 23 2021 : 09:50:41
|
I have created a solution by HACKING the imageenio unit (see attached file):
attach/PeterPanino/202152394228_imageenio.zip 99.83 KB
This now allows me to select frame #99 in a multi-frame GIF with this code:
ImageEnView1.IO.Seek(ieioSeekSpecific, '', 99);
However, to keep any changes, I still need to do this:
1. First save the current image to a temporary file 2. Do the frame selection with the above method 3. Set the ImageEnView filename back to its original filename
What do you think?
Would you upgrade imageenio to this enhanced version? |
 |
|
PeterPanino
   
951 Posts |
Posted - May 23 2021 : 10:13:10
|
Another solution would be to load all frames from the multi-frame file and keep them all in memory. Then, when selecting a frame, the concerning memory frame is copied to the ImageEnView. This would make frame selection faster but would require more time to load the frames (and of course it needs more memory).
What do you think? |
 |
|
xequte
    
38796 Posts |
Posted - May 23 2021 : 15:47:37
|
Hi Peter
Calling Seek with a frame number, will still load the image, so it has the same effect as setting ImageIndex and then loading.
ImageEnView is a single frame viewer, so changing a frame requires you to save the current image before it is replaced by the new image.
The method you should use it to load the GIF into a multi-bitmap object(non-visual: TIEMultiBitmap or visual: TImageEnMView), assign the "current" image to the TImageEnView for display and editing, then assign it back to the multi-bitmap object when changing to another frame.
You can then save all frames to file as required (from the multi-bitmap object).
Nigel Xequte Software www.imageen.com
|
 |
|
PeterPanino
   
951 Posts |
Posted - May 23 2021 : 17:05:07
|
Hi Nigel,
Thank you for the information. I now use a TImageEnMView, and it works well.
However, the additional Seek parameter would be nevertheless helpful to have.
|
 |
|
xequte
    
38796 Posts |
Posted - May 23 2021 : 23:27:22
|
Hi Peter
I'll look at that for a later update.
Nigel Xequte Software www.imageen.com
|
 |
|
PeterPanino
   
951 Posts |
Posted - May 24 2021 : 06:39:08
|
I have this cursor file (Handwriting.cur):
attach/PeterPanino/202152461937_Handwriting.zip 1.8 KB
I load it with: ImageEnMView1.LoadFromFileOnDemand(Handwriting.cur) . But it shows only 1 frame:

... and ImageEnView1.IO.Params.ImageCount = 2 (!)
... while IEGetFileFramesCount(Handwriting.cur) = 1 (!)
So how can I get the correct number of frames in a MultiFrame file, and what is generally the best method to load a MultiFrame file in a TImageEnMView independently of the MultiFrame file contains 1000 or 2 frames? |
 |
|
PeterPanino
   
951 Posts |
Posted - May 24 2021 : 08:41:20
|
When I use ImageEnMView1.MIO.LoadFromFileAuto(Handwriting.cur) then I get 2 frames! (Instead of 1).
But then I lose the advantages of loading the frames on demand!
How can I solve this dilemma? |
 |
|
xequte
    
38796 Posts |
Posted - May 24 2021 : 19:21:22
|
Hi
We've added support for CUR to TImageEnMView.LoadFromFileOnDemand and IEGetFileFramesCount. You can email me for an update.
Nigel Xequte Software www.imageen.com
|
 |
|
PeterPanino
   
951 Posts |
Posted - May 26 2021 : 03:40:24
|
Hi Nigel,
thank you for your amazing support! I have sent you the email. |
 |
|
|
Topic  |
|