Exemple #1
0
        public void FromStream(Stream input)
        {
            BitmapDecoder decoder = DecoderSelector.GetDecoder(input, BitmapCreateOptions.None,
                                                               BitmapCacheOption.None);

            FromBitmapSource(decoder.Frames[0]);
        }
Exemple #2
0
        public void FromStream(Stream input)
        {
            BitmapDecoder decoder = DecoderSelector.GetDecoder(input, BitmapCreateOptions.None,
                                                               BitmapCacheOption.None);

            foreach (BitmapFrame frame in decoder.Frames)
            {
                IImage image = Image.Create();
                image.FromBitmapSource(frame);


                BitmapMetadata metadata = frame.Metadata as BitmapMetadata;

                if (metadata?.ContainsQuery("/grctlext/Delay") == true)
                {
                    object delay = metadata.GetQuery("/grctlext/Delay");
                    image.AnimationDelay = (int)(Convert.ToDouble(delay) * 10.0);
                }

                Add(image);
            }

            Coalesce();
        }