我可以使用 BitmapEncoder (C#, WinRT) 创建动画 gif。但是,我一直无法弄清楚如何让 GIF 循环返回并从头开始?
没有尝试太多,因为我不确定要尝试什么。搜索要在 GIF 上设置的更多属性,但找不到任何相关内容。
我可以使用 BitmapEncoder (C#, WinRT) 创建动画 gif。但是,我一直无法弄清楚如何让 GIF 循环返回并从头开始?
没有尝试太多,因为我不确定要尝试什么。搜索要在 GIF 上设置的更多属性,但找不到任何相关内容。
好吧,终于可以弄明白了。显然,您需要将以下元数据添加到 GIF 以使其循环:
BitmapPropertySet properties = await encoder.BitmapProperties.GetPropertiesAsync("/appext/Data");
properties = new BitmapPropertySet()
{
{
"/appext/Application",
new BitmapTypedValue(Iso8859.Default.GetBytes("NETSCAPE2.0"), Windows.Foundation.PropertyType.UInt8Array)
},
{
"/appext/Data",
new BitmapTypedValue(new byte[] { 3, 1, 0, 0, 0 }, Windows.Foundation.PropertyType.UInt8Array)
},
};
await encoder.BitmapProperties.SetPropertiesAsync(properties);
如果您的项目中没有 Iso8859,只需将“NETSCAPE2.0”的 ascii 代码作为字节数组放入其中。