Can i use animated GIF into VVVV ?
I can’t find any node or library to do that.
Can i use animated GIF into VVVV ?
I can’t find any node or library to do that.
good question. anyone with a hint for a good .net gif library?
isn’t it possible through the HTML renderer?
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections.Generic;
using System.IO;
public class AnimatedGif {
private List<AnimatedGifFrame> mImages = new List<AnimatedGifFrame>();
PropertyItem mTimes;
public AnimatedGif(string path) {
Image img = Image.FromFile(path);
int frames = img.GetFrameCount(FrameDimension.Time);
if (frames <= 1) throw new ArgumentException("Image not animated");
byte[]() times = img.GetPropertyItem(0x5100).Value;
int frame = 0;
for (; ; ) {
int dur = BitConverter.ToInt32(times, 4 * frame);
mImages.Add(new AnimatedGifFrame(new Bitmap(img), dur));
if (++frame >= frames) break;
img.SelectActiveFrame(FrameDimension.Time, frame);
}
img.Dispose();
}
public List<AnimatedGifFrame> Images { get { return mImages; } }
}
public class AnimatedGifFrame {
private int mDuration;
private Image mImage;
internal AnimatedGifFrame(Image img, int duration) {
mImage = img; mDuration = duration;
}
public Image Image { get { return mImage; } }
public int Duration { get { return mDuration; } }
}