Save Method (Stream, ImageFormat)

Image.Save Method (Stream, ImageFormat)


Saves this image to the specified stream in the specified format.

Namespace:   System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

public void Save(
	Stream stream,
	ImageFormat format


Type: System.IO.Stream

The Stream where the image will be saved.

Type: System.Drawing.Imaging.ImageFormat

An ImageFormat that specifies the format of the saved image.

Exception Condition

stream or format is null.


The image was saved with the wrong image format

You should avoid saving an image to the same stream that was used to construct it. Doing so might damage the stream.

The image must be saved to the stream at an offset of zero. If any additional data has been written to the stream before saving the image, the image data in the stream will be corrupted.

.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft