Edit

Share via


Image.FromStream Method

Definition

Creates an Image from the specified data stream.

Overloads

FromStream(Stream, Boolean, Boolean)

Creates an Image from the specified data stream, optionally using embedded color management information and validating the image data.

FromStream(Stream)

Creates an Image from the specified data stream.

FromStream(Stream, Boolean)

Creates an Image from the specified data stream, optionally using embedded color management information in that stream.

FromStream(Stream, Boolean, Boolean)

Source:
Image.cs
Source:
Image.cs
Source:
Image.cs
Source:
Image.cs
Source:
Image.cs

Creates an Image from the specified data stream, optionally using embedded color management information and validating the image data.

public:
 static System::Drawing::Image ^ FromStream(System::IO::Stream ^ stream, bool useEmbeddedColorManagement, bool validateImageData);
public static System.Drawing.Image FromStream (System.IO.Stream stream, bool useEmbeddedColorManagement, bool validateImageData);
static member FromStream : System.IO.Stream * bool * bool -> System.Drawing.Image
Public Shared Function FromStream (stream As Stream, useEmbeddedColorManagement As Boolean, validateImageData As Boolean) As Image

Parameters

stream
Stream

A Stream that contains the data for this Image.

useEmbeddedColorManagement
Boolean

true to use color management information embedded in the data stream; otherwise, false.

validateImageData
Boolean

true to validate the image data; otherwise, false.

Returns

The Image this method creates.

Exceptions

The stream does not have a valid image format.

The stream does not have a valid image format.

Remarks

The useEmbeddedColorManagement parameter specifies whether the new Image applies color correction according to color management information that is embedded in the data stream. Embedded information can include International Color Consortium (ICC) profiles, gamma values, and chromaticity information.

Note

The Image class does not support alpha transparency in bitmaps. To enable alpha transparency, use PNG images with 32 bits per pixel.

Applies to

FromStream(Stream)

Source:
Image.cs
Source:
Image.cs
Source:
Image.cs
Source:
Image.cs
Source:
Image.cs

Creates an Image from the specified data stream.

public:
 static System::Drawing::Image ^ FromStream(System::IO::Stream ^ stream);
public static System.Drawing.Image FromStream (System.IO.Stream stream);
static member FromStream : System.IO.Stream -> System.Drawing.Image
Public Shared Function FromStream (stream As Stream) As Image

Parameters

stream
Stream

A Stream that contains the data for this Image.

Returns

The Image this method creates.

Exceptions

The stream does not have a valid image format

-or-

stream is null.

The stream does not have a valid image format.

Remarks

You must keep the stream open for the lifetime of the Image.

The stream is reset to zero if this method is called successively with the same stream.

Note

The Image class does not support alpha transparency in bitmaps. To enable alpha transparency, use PNG images with 32 bits per pixel.

Applies to

FromStream(Stream, Boolean)

Source:
Image.cs
Source:
Image.cs
Source:
Image.cs
Source:
Image.cs
Source:
Image.cs

Creates an Image from the specified data stream, optionally using embedded color management information in that stream.

public:
 static System::Drawing::Image ^ FromStream(System::IO::Stream ^ stream, bool useEmbeddedColorManagement);
public static System.Drawing.Image FromStream (System.IO.Stream stream, bool useEmbeddedColorManagement);
static member FromStream : System.IO.Stream * bool -> System.Drawing.Image
Public Shared Function FromStream (stream As Stream, useEmbeddedColorManagement As Boolean) As Image

Parameters

stream
Stream

A Stream that contains the data for this Image.

useEmbeddedColorManagement
Boolean

true to use color management information embedded in the data stream; otherwise, false.

Returns

The Image this method creates.

Exceptions

The stream does not have a valid image format

-or-

stream is null.

The stream does not have a valid image format.

Remarks

You must keep the stream open for the lifetime of the Image.

The useEmbeddedColorManagement parameter specifies whether the new Image applies color correction according to color management information that is embedded in the data stream. Embedded information can include International Color Consortium (ICC) profiles, gamma values, and chromaticity information.

The stream is reset to zero if this method is called successively with the same stream.

Note

The Image class does not support alpha transparency in bitmaps. To enable alpha transparency, use PNG images with 32 bits per pixel.

Applies to