locked
How Can I save Image picker RRS feed

  • Question

  • I use Image Picker to get Image , I save it in specific file in My project ??

    Dreamlight

    Tuesday, December 10, 2013 12:33 PM

Answers

  • What do you mean by a specific folder in your solution?

    You can save it to any folder in your application data section. You can acquire the folder from the root ApplicationData.Current.LocalFolder StorageFolder and then use GetFolderAsync to find a subfolder.

    --Rob

    Thursday, December 12, 2013 1:25 AM
    Moderator

All replies

  • What do you mean by image picker? A file picker targeting an image? The CameraCaptureUi to use the camera? How to save depends on what data you have.

    Assuming you have pixel data you can encode it with a BitmapEncoder and then stream that to  StorageFile. See http://code.msdn.microsoft.com/windowsapps/Media-Capture-Sample-adf87622

    Tuesday, December 10, 2013 4:22 PM
    Moderator
  • I mean file picker targeting Image .. I need to save it for local folder 

    Dreamlight

    Tuesday, December 10, 2013 7:28 PM
  • The FileOpenPicker returns a StorageFile. StorageFile has a CopyAsync method you can use to copy the file to a new folder.

                FileOpenPicker picker = new FileOpenPicker();
                picker.FileTypeFilter.Add(".jpg");
                picker.FileTypeFilter.Add(".png");
                StorageFile file = await picker.PickSingleFileAsync();
    
                await file.CopyAsync(ApplicationData.Current.LocalFolder, file.Name, NameCollisionOption.GenerateUniqueName);
    

    --Rob

    Tuesday, December 10, 2013 8:43 PM
    Moderator
  • hi If I need for spacific folder in my solution ?? 

    Dreamlight

    Wednesday, December 11, 2013 9:01 AM
  • What do you mean by a specific folder in your solution?

    You can save it to any folder in your application data section. You can acquire the folder from the root ApplicationData.Current.LocalFolder StorageFolder and then use GetFolderAsync to find a subfolder.

    --Rob

    Thursday, December 12, 2013 1:25 AM
    Moderator