Window Phone 8: How to read files from SavedPictures folder into a byte buffer

有些话、适合烂在心里 提交于 2019-12-12 02:35:35

问题


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


回答1:


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);                           

                    }
                }
            }
        }


来源:https://stackoverflow.com/questions/20876559/window-phone-8-how-to-read-files-from-savedpictures-folder-into-a-byte-buffer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!