title: how can crop image using c# windows phone
body: <p>how can crop image using c# windows phone </p>
  
  <p>crop rect from image </p>
  
  <p>how can crop face from image </p>
  
  <p>the code :</p>
  
  <pre><code>    BitmapImage bmp = new BitmapImage();
      bmp.SetSource(e.ChosenPhoto);
  
      imgShow.ImageSource = bmp;
      var wb = new WriteableBitmap(bmp);
      var sdkImg = ImageConverter.SystemToSdk(wb);
  
      IFaceDetector detector = FaceDetectorFactory.Create(FaceDetectionType.Haar);
      var gray = new ImageGray(sdkImg);
      FaceRect[] rc = detector.Detect(gray);
      MessageBox.Show(rc[0].ToString());
  
      faceRect.Margin = new Thickness(rc[1].Rect.Left / 2, rc[1].Rect.Top / 2, 0, 0);
      faceRect.Width = rc[1].Rect.Width;
      faceRect.Height = rc[1].Rect.Height;
      faceRect.Visibility = System.Windows.Visibility.Visible;
  </code></pre>