Jump to content
Xtreme .Net Talk

SilverX

Members
  • Posts

    1
  • Joined

  • Last visited

About SilverX

  • Birthday 07/30/1987

SilverX's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Here is the code I use to extract GIF frames EDIT: just so you are aware Image.FrameDimensionsList is an array of Guid's not Images/Bitmaps class Frame { public int Duration; public Bitmap Image; public Frame(int duration, Bitmap image) { Image = image; Duration = duration; } } // implementation Frame[] frames; FrameDimension fd = new FrameDimension(image.FrameDimensionsList[0]); int frameCount = image.GetFrameCount(fd); if (frameCount > 1) { frames = new Frame[frameCount]; //0x5100 is the property id of the GIF frame's durations //this property does not exist when frameCount <= 1 byte[] times = image.GetPropertyItem(0x5100).Value; for (int i = 0; i < frameCount; i++) { //selects GIF frame based on FrameDimension and frameIndex image.SelectActiveFrame(fd, i); //length in milliseconds of display duration int length = BitConverter.ToInt32(times, 4 * i) * 10; //save currect image frame as new bitmap frames[i] = new Frame(length, new Bitmap(image)); } } // Not animated
×
×
  • Create New...