title: How can I reduce the size of an image
body: <p>I am trying to reduce the size of an Image I am taking from the camera before I save it to Isolated Storage. I already have it reduced to the lowest resolution (640x480)  How can I reduce the bytes to 100kb instead of what they are coming out at almost 1mb.</p>
  
  <pre><code>void cam_CaptureImageAvailable(object sender, Microsoft.Devices.ContentReadyEventArgs e)
      {
  
          string fileName = folderName+"\\MyImage" + savedCounter + ".jpg";
  
          try
          {   
  
              // Set the position of the stream back to start
              e.ImageStream.Seek(0, SeekOrigin.Begin);
  
              // Save picture as JPEG to isolated storage.
              using (IsolatedStorageFile isStore = IsolatedStorageFile.GetUserStoreForApplication())
              {
                  using (IsolatedStorageFileStream targetStream = isStore.OpenFile(fileName, FileMode.Create, FileAccess.Write))
                  {
  
                      // Initialize the buffer for 4KB disk pages.
                      byte[] readBuffer = new byte[4096];
                      int bytesRead = -1;
  
                      // Copy the image to isolated storage. 
                      while ((bytesRead = e.ImageStream.Read(readBuffer, 0, readBuffer.Length)) &gt; 0)
                      {
                          targetStream.Write(readBuffer, 0, bytesRead);
                      }
  
                  }
  
              }
  
  
  
  
          }
          finally
          {
              // Close image stream
              e.ImageStream.Close();
          }
  
      }
  </code></pre>