سؤال

How can we use Pictures/RootPictureAlbum/SavedPicture API of MediaLibrary class to access the photos in SavedPicture folder to read them into byte buffer?

هل كانت مفيدة؟

المحلول

Try by this way

        using (var library = new MediaLibrary())
        {

            var savedPictures = library.Pictures.ToList();
            if (savedPictures.Any())
            {
                foreach (var pic in savedPictures)
                {
                    var bitmap = new WriteableBitmap(pic.Width, pic.Height);
                    using (var stream = pic.GetImage()) //here you will get the stream
                    {

                        bitmap.SetSource(stream);                           

                    }
                }
            }
        }
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top