Drawing. Imaging Namespace
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides advanced GDI+ imaging functionality. Basic graphics functionality is provided by the System.Drawing namespace.
Defines a 5 x 5 matrix that contains the coordinates for the RGBAW space. Several methods of the ImageAttributes class adjust image colors by using a color matrix. This class cannot be inherited.
Defines an array of colors that make up a color palette. The colors are 32-bit ARGB colors. Not inheritable.
An Encoder object encapsulates a globally unique identifier (GUID) that identifies the category of an image encoder parameter.
Used to pass a value, or an array of values, to an image encoder.
Encapsulates an array of EncoderParameter objects.
Provides properties that get the frame dimensions of an image. Not inheritable.
Contains information about how bitmap and metafile colors are manipulated during rendering.
The ImageCodecInfo class provides the necessary storage members and methods to retrieve all pertinent information about the installed image encoders and decoders (called codecs). Not inheritable.
Specifies the file format of the image. Not inheritable.
Defines a graphic metafile. A metafile contains records that describe a sequence of graphics operations that can be recorded (constructed) and played back (displayed). This class is not inheritable.
Contains attributes of an associated Metafile. Not inheritable.
Contains information about a windows-format (WMF) metafile.
Encapsulates a metadata property to be included in an image file. Not inheritable.
Defines a placeable metafile. Not inheritable.
Specifies which GDI+ objects use color adjustment information.
Specifies individual channels in the CMYK (cyan, magenta, yellow, black) color space. This enumeration is used by the SetOutputChannel methods.
Specifies the types of color maps.
Specifies the types of images and colors that will be affected by the color and grayscale adjustment settings of an ImageAttributes.
Specifies two modes for color component values.
Specifies the methods available for use with a metafile to read and write graphic commands.
Specifies the nature of the records that are placed in an Enhanced Metafile (EMF) file. This enumeration is used by several constructors in the Metafile class.
Provides attributes of an image encoder/decoder (codec).
Specifies the unit of measurement for the rectangle used to size and position a metafile. This is specified during the creation of the Metafile object.
Specifies types of metafiles. The Type property returns a member of this enumeration.
Specifies the type of color data in the system palette. The data can be color data with alpha, grayscale data only, or halftone data.
Specifies the format of the color data for each pixel in the image.
This delegate is not used. For an example of enumerating the records of a metafile, see EnumerateMetafile(Metafile, Point, Graphics+EnumerateMetafileProc).
System.Drawing namespace has some limitations for certain operating systems and application types.
System.Drawingdepends on the GDI+ native library, which is shipped as part of the OS. Some Windows SKUs, like Windows Server Core or Windows Nano, don't include this native library as part of the OS. If you use this namespace and the library can't be loaded, exceptions will be thrown at run time.
Some types in the
System.Drawingnamespace rely on GDI+, which is not supported in Windows services and ASP.NET Core and ASP.NET apps. These types are in the System.Drawing.Common NuGet package and include System.Drawing.Bitmap and System.Drawing.Font. However, primitive types in the namespace, such as System.Drawing.Color, System.Drawing.Size, System.Drawing.Point, and System.Drawing.Rectangle, can be used in any application.
In .NET 5 and previous versions, the System.Drawing.Common NuGet package works on Windows, Linux, and macOS. However, there are some platform differences. On Linux and macOS, the GDI+ functionality is implemented by the libgdiplus) library. This library is not installed by default in most Linux distributions and doesn't support all the functionality of GDI+ on Windows and macOS. There are also platforms where libgdiplus is not available at all. To use types from the System.Drawing.Common package on Linux and macOS, you must install libgdiplus separately. For more information, see Install .NET on Linux or Install .NET on macOS.
The Metafile class provides methods for recording and saving metafiles. The Encoder class enables users to extend GDI+ to support any image format. The PropertyItem class provides methods for storing and retrieving metadata in image files.
Classes within the System.Drawing.Imaging namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions.