Monday, June 6, 2011

Windows Phone: Capture + Resize Image using the phone camera

Sample code. It’s not tested, so let me know if there are any issues:

Basically a wrapper around CaptureCameraTask with some image resize filling.



      private void ConfirmMarkerPicture_Click(object sender, RoutedEventArgs e)
CameraTask task = new CameraTask();
task.TakePicture(CameraTask_TakenPicture, true);

private void CameraTask_TakenPicture(BitmapImage image)
_imgMarker.Source = image;

… where _imgMarker is type Image.

There are also Resize Width and Height properties which can be set prior to TakePicture call.

Happy coding Smile.

No comments: