MediaLibrary.SavePicture Method (String, Stream)

Saves the image contained in the stream object to the media library, and then returns that saved image as a picture object.

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Function SavePicture ( _
         name As String, _
         source As Stream _
) As Picture 
[SecuritySafeCriticalAttribute]
public Picture SavePicture (
         string name,
         Stream source
)
[SecuritySafeCriticalAttribute]
public:
Picture SavePicture(
         String name,
         Stream source
)

Parameters

  • name
    Type: String
    Name of the image file that is saved to the media library.
  • source
    Type: Stream
    Stream object that contains the image information in the required JPEG file format.

Return Value

Type: Picture
The Picture object that represents the saved image.

Remarks

Image data that is passed in must be in a JPEG file format. SavePicture always saves the image in a JPEG file format.

Capabilities for Windows Phone

If you use this API in your Windows Phone app, you must specify the following capabilities in the app manifest. Otherwise, your app might not work correctly or it might exit unexpectedly.

ID_CAP_MEDIALIB_PHOTO Windows Phone 8
ID_CAP_MEDIALIB Windows Phone OS 7.1

For more info, see App capabilities and hardware requirements for Windows Phone.

Requirements

Namespace: Microsoft.Xna.Framework.Media

Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

See Also

Concepts

Media Overview
Accessing Pictures from a Picture Album

Reference

MediaLibrary Class
MediaLibrary Members
Microsoft.Xna.Framework.Media Namespace

Platforms

Windows Phone