Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Add repeat count to GIF image using WIC in WIndows 8

By: tomlev on Mar 19th, 2013  |  syntax: C#  |  size: 0.68 KB  |  views: 147  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.     uint repeatCount = ...;
  2.     using (var netscapeData = new MemoryStream(4))
  3.     using (var writer = new BinaryWriter(netscapeData))
  4.     {
  5.         writer.Write((byte)3); // Number of following data bytes
  6.         writer.Write((byte)1); // Always 1
  7.         writer.Write(repeatCount);
  8.         writer.Flush();
  9.    
  10.         var containerProperties = new BitmapPropertySet
  11.         {
  12.             { "/appext/Application", new BitmapTypedValue("NETSCAPE2.0", PropertyType.String) },
  13.             { "/appext/Data", new BitmapTypedValue(netscapeData.ToArray(), PropertyType.UInt8Array) },
  14.         };
  15.         await encoder.BitmapContainerProperties.SetPropertiesAsync(containerProperties);
  16.     }