Position of frames in animated gif
Moderators: helmut, XnTriq, xnview
Position of frames in animated gif
Hi,
I thought I had solved my problems during the loading of animated gif files, instead lately I've found a file which I couldn't load properly.
Looks like some of the frames are smaller than frame 0 and I dunno where to place them inside the canvas because I don't find offset values in GFL_BITMAP or in other structures.
Right now I can only place them on top-left of canvas but of course the animation doesn't look good.
Thanks in advance for your reply.
I thought I had solved my problems during the loading of animated gif files, instead lately I've found a file which I couldn't load properly.
Looks like some of the frames are smaller than frame 0 and I dunno where to place them inside the canvas because I don't find offset values in GFL_BITMAP or in other structures.
Right now I can only place them on top-left of canvas but of course the animation doesn't look good.
Thanks in advance for your reply.
Hi,
to position the frames inside the canvas I used a code like follows:
but I still don't obtain the correct positions
I've also found out where the framerate is stored:
yet the positon of this tructure changes so I dunno how to find the offset from the start of the file....
Can you help me?
Please, at least say "I don't know"...if that's the case
Thanks.
to position the frames inside the canvas I used a code like follows:
Code: Select all
int LeftOfNewFrame=(gflBmp->Origin & GFL_RIGHT)!=0 ? WidthOfFirstFrame- WidthOfNewFrame: 0;
int TopOfNewFrame=(gflBmp->Origin & GFL_BOTTOM)!=0 ? HeightOfFirstFrame-HeightOfNewFrame : 0;
I've also found out where the framerate is stored:
Code: Select all
typedef struct { // 6 bytes
unsigned char iBlockSize; // Must be 4
unsigned char iTransparentColorFlag : 1;
unsigned char iUserInputFlag : 1;
unsigned char iDisposalMethod : 3;
unsigned char iReserved : 3;
unsigned short iDelayTime;
unsigned char iTransparentColorIndex;
unsigned char iBlockTerminator; // Must be 0
} GIF_GRAPHIC_CONTROL_EXTENSION;
Can you help me?
Please, at least say "I don't know"...if that's the case
Thanks.
Re: Position of frames in animated gif
Currently there is no way to retrieve frame position...Alessandro wrote:Hi,
I thought I had solved my problems during the loading of animated gif files, instead lately I've found a file which I couldn't load properly.
Looks like some of the frames are smaller than frame 0 and I dunno where to place them inside the canvas because I don't find offset values in GFL_BITMAP or in other structures.
Right now I can only place them on top-left of canvas but of course the animation doesn't look good.
Pierre.
But perhaps better for you will be to load the merged frame?Alessandro wrote:Do you plan to add the needed fields sooner or later or should I start to write a workaround myself (if I can find enough info of course)?
Because in GIF, you have not only the offset, but the copy method, palette change, ...
Pierre.
Change of palette doesn't really matter since I convert frames to rgb32, anyway I read thoroughly the help file and I can't recall a way to load merged frames excluding frame 0 which is only one frame (and not enough then to show animations), but if such an option is available of course it IS be better to me to use it, so... how can I do it?
You want only show animation?Alessandro wrote:Change of palette doesn't really matter since I convert frames to rgb32, anyway I read thoroughly the help file and I can't recall a way to load merged frames excluding frame 0 which is only one frame (and not enough then to show animations), but if such an option is available of course it IS be better to me to use it, so... how can I do it?
Pierre.