title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | description | |||
---|---|---|---|---|---|---|---|---|
How to: Determine the Parameters Supported by an Encoder |
03/30/2017 |
|
|
f47ae459-e3ce-4d41-a140-2f6c6aea3f44 |
Learn how to determine the parameters supported by an Encoder using the GetEncoderParameterList method provided by the Image class. |
You can adjust image parameters, such as quality and compression level, but you must know which parameters are supported by a given image encoder. The xref:System.Drawing.Image class provides the xref:System.Drawing.Image.GetEncoderParameterList%2A method so that you can determine which image parameters are supported for a particular encoder. You specify the encoder with a GUID. The xref:System.Drawing.Image.GetEncoderParameterList%2A method returns an array of xref:System.Drawing.Imaging.EncoderParameter objects.
The following example code outputs the supported parameters for the JPEG encoder. Use the list of parameter categories and associated GUIDs in the xref:System.Drawing.Imaging.Encoder class overview to determine the category for each parameter.
[!code-csharpUsingImageEncodersDecoders#3] [!code-vbUsingImageEncodersDecoders#3]
This example requires:
-
A Windows Forms application.
-
A xref:System.Windows.Forms.PaintEventArgs, which is a parameter of xref:System.Windows.Forms.PaintEventHandler.