2 Attachment(s)
[VB6] Creation of GIF-animation with the transparent background.
Hi everyone!
This project allows to create an GIF animations with the transparent background. As far as i know the GDI+ doesn't allow to set the property of "Disposal Method" in the "Graphic Control Extension" block, therefore each next frame is overlayed to the previous frame. For the opaque frames it's doesn't matter. In order to solve this issue i decide to change the needed bytes manually in the raw GIF file.
It allows to prevent the restrictions of the transparent frames. Also this example contains the oct-tree class, which calculates the optimal palette for the each frame. There are the ability of the additional settings: threshold of the transparency, duration, and number of the loops for entire animation. For the disabling of the transparency enough set the threshold to zero. The greater the value of the threshold field the greater semitransparent pixels become transparent completely.
http://thetrick.esy.es/Images/Anim128threshold.gif
Attachment 131865
Regards,
Кривоус Анатолий.
Re: [VB6] Creation of GIF-animation with the transparent background.
Setting the GIF frame structure to specifically define the disposal code is the right choice, I agree. A couple of other points of interest
1. GdipGetImageThumbnail is ok, however, it can produce poor scaling. Just FYI
2. GdipSaveAddImage does not work on earlier versions of GDI+ for GIFs. Maybe there should be a validation check?
3. You may want to check to see a color table is being created for every frame. If it is, then the GIF can be much larger than needed. Without checking, I don't know if GdipSaveAddImage creates a local color table per frame or if it changes the pixel data to force using the global color table. In my projects, I build a color table that can be used by the most frames and set that color table as global and tell each of those frames to use the global. For the remaining frames that cannot use it, they keep their local color table.
Re: [VB6] Creation of GIF-animation with the transparent background.
LaVolpe, thanks for response.
Quote:
Originally Posted by
LaVolpe
1. GdipGetImageThumbnail is ok, however, it can produce poor scaling. Just FYI
Ok, i didn't know. Thanks.
Quote:
Originally Posted by
LaVolpe
GdipSaveAddImage does not work on earlier versions of GDI+ for GIFs. Maybe there should be a validation check?
Yes, as far as i know it doesn't work in XP. I was having my own code for the creation GIF frame, but it's written on C++. Maybe ever i'll update this code. Honestly, it is old project, i just posted it here.
Quote:
Originally Posted by
LaVolpe
You may want to check to see a color table is being created for every frame. If it is, then the GIF can be much larger than needed. Without checking, I don't know if GdipSaveAddImage creates a local color table per frame or if it changes the pixel data to force using the global color table. In my projects, I build a color table that can be used by the most frames and set that color table as global and tell each of those frames to use the global. For the remaining frames that cannot use it, they keep their local color table.
In this example is created the palette for each frame. Just use oct-tree class, we can calculate the optimal palette for each frame and for entire animation.
Re: [VB6] Creation of GIF-animation with the transparent background.
can not used in xp, can you fixed?thanks!
Re: [VB6] Creation of GIF-animation with the transparent background.
It was already stated that this method doesn't work on XP...
Quote:
Yes, as far as i know it doesn't work in XP. I was having my own code for the creation GIF frame, but it's written on C++. Maybe ever i'll update this code. Honestly, it is old project, i just posted it here.
Re: [VB6] Creation of GIF-animation with the transparent background.
Quote:
Originally Posted by
xxdoc
can not used in xp, can you fixed?thanks!
Hi. I'll fix it later.
Re: [VB6] Creation of GIF-animation with the transparent background.
Re: [VB6] Creation of GIF-animation with the transparent background.
Re: [VB6] Creation of GIF-animation with the transparent background.
Don't you just hate it when someone says they'll do something and you never hear from them again
Re: [VB6] Creation of GIF-animation with the transparent background.
Don't know about that, but I sure do get aggravated by passive-aggressive voice.
This is a forum of volunteers, many of whom are talented enough to be as busy as they want to be. People forget, or have other priorities, or just lose interest. There's no requirement on them, nor are they profiting from providing free code. You might ask them, if it matters that much.
Re: [VB6] Creation of GIF-animation with the transparent background.
Don't know about that, but I sure do get aggravated by passive-aggressive voice.
This is a forum of volunteers, many of whom are talented enough to be as busy as they want to be. People forget, or have other priorities, or just lose interest. There's no requirement on them, nor are they profiting from providing free code. You might ask them, if it matters that much.
Re: [VB6] Creation of GIF-animation with the transparent background.
Code Dummy, sorry if you're still waiting the sources but i don't have the time and the interest for that project (i have the more priority projects). I wrote:
and didn't specify any time ranges.
Re: [VB6] Creation of GIF-animation with the transparent background.
Is there any other way to create GIF with VB6 or vb.net?
how to use、import .net frame method in vb6?
Re: [VB6] Creation of GIF-animation with the transparent background.
Quote:
Originally Posted by
xiaoyao
Is there any other way to create GIF with VB6 or vb.net?
how to use、import .net frame method in vb6?
xiaoyao, don't abuse the thread with an irrelevant question.
Re: [VB6] Creation of GIF-animation with the transparent background.
I love how small the code is. Do you know how to load an image from an stdpicture or hWnd, and save to a byte array instead of a file?