두 개의 버튼과 이미지 컨트롤이 있습니다.Windows App Store에서 이미지 저장
Now 첫 번째 버튼을 클릭하면 아래와 같이 이미지를로드하려고합니다. 내가 두번째 버튼을 클릭 할 때
Dim openPicker As New FileOpenPicker
openPicker.ViewMode = PickerViewMode.Thumbnail
openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary
openPicker.FileTypeFilter.Add(".jpg")
openPicker.FileTypeFilter.Add(".jpeg")
openPicker.FileTypeFilter.Add(".png")
Dim file As StorageFile = Await openPicker.PickSingleFileAsync
If Nothing IsNot file Then
Dim image As New BitmapImage()
Dim stream = Await file.OpenAsync(Windows.Storage.FileAccessMode.Read)
image.SetSource(stream)
Image1.Source = image
LayoutRoot.Visibility = Windows.UI.Xaml.Visibility.Collapsed
txtImgdisplay.Text = file.Path
Else
txtImgdisplay.Text = "Invalid File"
End If
은 지금은 사진 라이브러리 같은 이미지에 일부 수정 후 해당 이미지를 저장해야합니다.
이것은 이미지 컨트롤에 이미로드 된 이미지를 가져 와서 저장하는 방법을 혼란스럽게 만드는 것입니다.
Dim fileSavePicker As New FileSavePicker()
fileSavePicker.FileTypeChoices.Add("PNG", New String() {".png"})
fileSavePicker.FileTypeChoices.Add("JPG", New String() {".jpg"})
fileSavePicker.FileTypeChoices.Add("BMP", New String() {".bmp"})
fileSavePicker.FileTypeChoices.Add("TIFF", New String() {".tiff"})
fileSavePicker.FileTypeChoices.Add("EXIF", New String() {".exif"})
fileSavePicker.FileTypeChoices.Add("ICO", New String() {".ico"})
Dim saveFile As StorageFile = Await fileSavePicker.PickSaveFileAsync()
If Nothing IsNot saveFile Then
Dim image As New BitmapImage()
Dim stream = Await StorageFile.GetFileFromPathAsync(txtImgdisplay.Text)
LayoutRoot.Visibility = Windows.UI.Xaml.Visibility.Collapsed
txtImgdisplay.Text = saveFile.Path
Image1.Source = image
Dim copyFile As StorageFile = Await saveFile.CopyAsync(Windows.Storage.KnownFolders.PicturesLibrary, "sample - Copy.png")
Else
txtImgdisplay.Text = "Invalid File"
End If
@ Aprough - 답장을 보내 주셔서 감사합니다.하지만 이미지 저장 방법은 없습니다. – coder
사과드립니다. 귀하의 코드를 잘못 읽고 BitmapImage가 아니라 Bitmap이라고 생각했습니다. – APrough
오늘 아침 이후로 내 머리를 두드리는 것은 사과 할 필요가 없다. 그러나 그것을 이해할 수 없었다. – coder