SHARE
TWEET

Add repeat count to GIF image using WIC in WIndows 8

tomlev Mar 19th, 2013 234 Never
  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.     }
RAW Paste Data
Top