Image.FromStream Method (Stream, Boolean, Boolean)
Creates an Image from the specified data stream, optionally using embedded color management information and validating the image data.
Assembly: System.Drawing (in System.Drawing.dll)
public static Image FromStream( Stream stream, bool useEmbeddedColorManagement, bool validateImageData )
Parameters
- stream
- Type: System.IO.Stream
A Stream that contains the data for this Image.
- useEmbeddedColorManagement
- Type: System.Boolean
true to use color management information embedded in the data stream; otherwise, false.
- validateImageData
- Type: System.Boolean
true to validate the image data; otherwise, false.
| Exception | Condition |
|---|---|
| ArgumentException |
The stream does not have a valid image format. |
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. |
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note