Reading Metadata property of GifBitmapDecoder…why is it null?

前端 未结 1 1338
独厮守ぢ
独厮守ぢ 2021-01-24 17:08

How can I read the delay, left and top offset data for each frame of a gif? I\'ve gotten this far.

  1. Load the Gif

    var myGif = new GifBitmapDecoder(u

相关标签:
1条回答
  • 2021-01-24 17:29

    First, you need to Freeze the Frame you want to obtain the metadata from:

    var frame = myGif.Frames[0];
    frame.Freeze();
    

    Second, the frame.Metadata returns an ImageMetadata which does not have a GetQuery method, but in fact the object returned is of type BitmapMetadata which has a GetQuery method, so you just need to cast frame.Metadata to BitmapMetadata as you do in the last commented lines of your code.

    0 讨论(0)
提交回复
热议问题