Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Extensions.SaveJpeg Method

Encodes a WriteableBitmap object into a JPEG stream, with parameters for setting the target width and height of the JPEG file.

Namespace:  System.Windows.Media.Imaging
Assembly:  Microsoft.Phone (in Microsoft.Phone.dll)

public static void SaveJpeg(
	this WriteableBitmap bitmap,
	Stream targetStream,
	int targetWidth,
	int targetHeight,
	int orientation,
	int quality
)

Parameters

bitmap
Type: System.Windows.Media.Imaging.WriteableBitmap
The WriteableBitmap object.
targetStream
Type: System.IO.Stream
The image data stream.
targetWidth
Type: System.Int32
The target width of the file.
targetHeight
Type: System.Int32
The target height of the file.
orientation
Type: System.Int32
This parameter is not currently used by this method. Use a value of 0 as a placeholder.
quality
Type: System.Int32
This parameter represents the quality of the JPEG photo with a range between 0 and 100, with 100 being the best photo quality. We recommend that you do not fall lower than a value of 70. because JPEG picture quality diminishes significantly below that level.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type WriteableBitmap. When you use instance method syntax to call this method, omit the first parameter.

NoteNote:

The position of targetStream cannot be used to determine the size of the encoded data. Further use of targetStream can have unpredictable results if the position of the stream is not explicitly set.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2015 Microsoft