Saving Image without change a pixel colors

Jun 5, 2013 at 9:48 AM
Hello Admin,
First, I thanks for this library.. That's a wonderful library to get and set pixel image.
Now I in reasearch about image processing and I using this library, but I have a problem when
save image, function(saveJPEG or SavePicture) has changed all pixel color.
For Example data :
Pixel original before saving library :
Color[0] : R=239, B=242,G=234
Color[1] : R=238, B=237,G=232
Color[2] : R=240, B=241,G=233
Color[3] : R=237, B=238,G=233
Color[4] : R=236, B=240,G=233

Pixel after saved to library :
Color[0] : R=237, B=242,G=233
Color[1] : R=240, B=238,G=234
Color[2] : R=238, B=240,G=233
Color[3] : R=237, B=239,G=232
Color[4] : R=233, B=238,G=231

I copy my function when save to library in below :

Function 1 : Saving image to library
 String nameFile = "EncyptImage.jpg";
                var store = IsolatedStorageFile.GetUserStoreForApplication();
                if (store.FileExists(nameFile))
                {
                    store.DeleteFile(nameFile);
                }

        
                IsolatedStorageFileStream fileStream = store.CreateFile(nameFile);
                WriteableBitmap wb = GetNewImage(_colors);
                Extensions.SaveJpeg(wb, fileStream, wb.PixelWidth, wb.PixelHeight, 0, 100);
                fileStream.Close();
                fileStream = store.OpenFile(nameFile, FileMode.Open, FileAccess.Read);
                fileStream.Position = 0;
                MediaLibrary mediaLibrary = new MediaLibrary();
                Picture pic = mediaLibrary.SavePicture(nameFile, fileStream); 
                fileStream.Close();
Function 2 : Get new Image from colors
  private WriteableBitmap GetNewImage(Color[] _colors)
  {
      WriteableBitmap bmpImage = new WriteableBitmap(_image.PixelWidth, _image.PixelHeight);
            return bmpImage;
  }
I already tried change Extensions.SaveJpeg(wb, fileStream, wb.PixelWidth, wb.PixelHeight, 0, 100); in function 1 to wb.WriteTga(fileStream); but throw an exception : Value does not fall within the expected range.

If you know about saving image without change a pixel color in windows phone 7.1 or later, could you help me to solve this problem?


Thank you,

Regards,
Darmawan Efendi & Ahoy.