Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 1.95 KB

how-to-determine-the-parameters-supported-by-an-encoder.md

File metadata and controls

35 lines (25 loc) · 1.95 KB
title ms.date dev_langs helpviewer_keywords ms.assetid description
How to: Determine the Parameters Supported by an Encoder
03/30/2017
csharp
vb
encoder parameters [Windows Forms], determining supported
f47ae459-e3ce-4d41-a140-2f6c6aea3f44
Learn how to determine the parameters supported by an Encoder using the GetEncoderParameterList method provided by the Image class.

How to: Determine the Parameters Supported by an Encoder

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.

Example

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]

Compiling the Code

This example requires:

  • A Windows Forms application.

  • A xref:System.Windows.Forms.PaintEventArgs, which is a parameter of xref:System.Windows.Forms.PaintEventHandler.

See also