1

変数 WriteableBitmap の内容を IsolatedStorageFile に保存する簡単な方法はありますか? WriteableBitmap 内のピクセルを処理し、処理されたビットマップをファイル *.bmp として保存し、「保存された画像」ディレクトリに保存するプログラムを作成しています。WriteableBitmap を jpeg ファイルとして保存するコードがありますが、前に述べたように、グラフィックを圧縮したくありません。私の問題を解決するのを手伝ってください。

private void Save_as_bmp(object sender, RoutedEventArgs e)
    {



        String temp = "photo.bmp";

        using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
        {
            if (myIsolatedStorage.FileExists(temp))
            {
                myIsolatedStorage.DeleteFile(temp);
            }

            IsolatedStorageFileStream fileStream = myIsolatedStorage.CreateFile(tempJPEG);

            //Writeable wb declared in another method

            //JPEG compression  
            //wb.SaveJpeg(fileStream, wb.PixelWidth, wb.PixelHeight, 0, 100); 

            //  In this place I need to  save variable wb to file stream without any compression
            // something like - fileStram = wb.content;


            fileStream.Close();
        }


        using (IsolatedStorageFile myIsolatedStorage2 = IsolatedStorageFile.GetUserStoreForApplication())
        {
            using (IsolatedStorageFileStream fileStream2 = myIsolatedStorage2.OpenFile("photo.bmp", FileMode.Open, FileAccess.Read))
            {

                try
                {

                    var mediaLibrary2 = new MediaLibrary();
                    mediaLibrary2.SavePicture("raster_graphic", fileStream2);
                    //mediaLibrary2.SavePictureToCameraRoll("raster_graphic", fileStream2);
                    MessageBox.Show("Image saved");
                    //fileStream2.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error, exception: " + ex.Message);
                }
            }
        }



    }
4

1 に答える 1