Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3802604
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:14:04+00:00 2026-05-19T14:14:04+00:00

I want to save image in WP7 phone on a button click Following is

  • 0

I want to save image in WP7 phone on a button click
Following is the code

 private void wallpaper_Click(object sender, RoutedEventArgs e)
    {

        String imageName ="temjpeg";      I

        // Create virtual store and file stream. Check for duplicate tempJPEG files.
        var myStore = IsolatedStorageFile.GetUserStoreForApplication();
        if (myStore.FileExists(temjpeg))
        {
            myStore.DeleteFile(temjpeg);
        }

        IsolatedStorageFileStream myFileStream = myStore.CreateFile(imageName);


        // Create a stream out of the sample JPEG file.
        // For [Application Name] in the URI, use the project name that you entered in                               the previous steps. Also TestImage.jpg is an example,
        //you must enter your JPEG filename if it is different.
        StreamResourceInfo sri = null;
        Uri uri = new Uri("some String",UriKind.Relative);
        sri = Application.GetResourceStream(uri);

        // Create a new WriteableBitmap object and set it to the JPEG stream.
        BitmapImage bitmap = new BitmapImage();
        bitmap.SetSource(sri.Stream);
        WriteableBitmap wb = new WriteableBitmap(bitmap);


        // Encode WriteableBitmap object to a JPEG stream.
        // SaveJpeg(WriteableBitmap bitmap, Stream targetStream, int targetWidth, int targetHeight, int orientation, int quality)
        Extensions.SaveJpeg(wb, myFileStream, wb.PixelWidth, wb.PixelHeight, 0, 85);
        myFileStream.Close();


        // Create a new stream from isolated storage, and save the JPEG file to the media library on Windows Phone.
        myFileStream = myStore.OpenFile(temjpeg, FileMode.Open, FileAccess.Read);

        MediaLibrary library = new MediaLibrary();

         Picture pic = library.SavePicture(imageName, myFileStream);
        myFileStream.Close();
         }

But this code throws InvalidOperationException on line : Picture pic = library.SavePicture(imageName, myFileStream);
What could be the problem?..
after the exception problem was solved,now the image is saving multiple times if save button is clicked multiple times.Can someone help ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T14:14:05+00:00Added an answer on May 19, 2026 at 2:14 pm

    Are you doing this on the emulator as SavePicture will not work on the emulator, only on the actual phone itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my code and I want the save image button to simply save
I want to save the image when you click on the same as provided
I want to save image from chart graphic. I'm using following line. chart.SaveImage(D:\\mypic.png, System.Web.UI.DataVisualization.Charting.ChartImageFormat.Png);
I want to save image in gallery in specific folder. When i click save
I have a Image, FileUpload and a Button controls. I want to save the
In my signed applet I have an Image object, Now I want to save
I want to save Image in Database with JSON web service .without image data
I have an image in an UIImageView and want to save it to the
I'm using 3d in WPF and want to save it to a 2d image
I want to extract first frame of uploaded video and save it as image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.