EncoderParameter Constructors

Definition

Initializes a new instance of the EncoderParameter class with the specified Encoder object and value.

Overloads

EncoderParameter(Encoder, Byte)

Initializes a new instance of the EncoderParameter class with the specified Encoder object and one unsigned 8-bit integer. Sets the ValueType property to ValueTypeByte, and sets the NumberOfValues property to 1.

EncoderParameter(Encoder, Int32[], Int32[], Int32[], Int32[])

Initializes a new instance of the EncoderParameter class with the specified Encoder object and four arrays of 32-bit integers. The four arrays represent an array rational ranges. A rational range is the set of all fractions from a minimum fractional value through a maximum fractional value. Sets the ValueType property to ValueTypeRationalRange, and sets the NumberOfValues property to the number of elements in the numerator1 array, which must be the same as the number of elements in the other three arrays.

EncoderParameter(Encoder, Int32, Int32, Int32, Int32)

Initializes a new instance of the EncoderParameter class with the specified Encoder object and four, 32-bit integers. The four integers represent a range of fractions. The first two integers represent the smallest fraction in the range, and the remaining two integers represent the largest fraction in the range. Sets the ValueType property to ValueTypeRationalRange, and sets the NumberOfValues property to 1.

EncoderParameter(Encoder, Int32, Int32)

Initializes a new instance of the EncoderParameter class with the specified Encoder object and a pair of 32-bit integers. The pair of integers represents a fraction, the first integer being the numerator, and the second integer being the denominator. Sets the ValueType property to ValueTypeRational, and sets the NumberOfValues property to 1.

EncoderParameter(Encoder, Int32, Int32, Int32)
Obsolete.
Obsolete.
Obsolete.

Initializes a new instance of the EncoderParameter class with the specified Encoder object and three integers that specify the number of values, the data type of the values, and a pointer to the values stored in the EncoderParameter object.

EncoderParameter(Encoder, Int32, EncoderParameterValueType, IntPtr)

Initializes a new instance of the EncoderParameter class with the specified Encoder object, number of values, data type of the values, and a pointer to the values stored in the EncoderParameter object.

EncoderParameter(Encoder, Int64, Int64)

Initializes a new instance of the EncoderParameter class with the specified Encoder object and a pair of 64-bit integers. The pair of integers represents a range of integers, the first integer being the smallest number in the range, and the second integer being the largest number in the range. Sets the ValueType property to ValueTypeLongRange, and sets the NumberOfValues property to 1.

EncoderParameter(Encoder, Int32[], Int32[])

Initializes a new instance of the EncoderParameter class with the specified Encoder object and two arrays of 32-bit integers. The two arrays represent an array of fractions. Sets the ValueType property to ValueTypeRational, and sets the NumberOfValues property to the number of elements in the numerator array, which must be the same as the number of elements in the denominator array.

EncoderParameter(Encoder, Int64[], Int64[])

Initializes a new instance of the EncoderParameter class with the specified Encoder object and two arrays of 64-bit integers. The two arrays represent an array integer ranges. Sets the ValueType property to ValueTypeLongRange, and sets the NumberOfValues property to the number of elements in the rangebegin array, which must be the same as the number of elements in the rangeend array.

EncoderParameter(Encoder, Byte, Boolean)

Initializes a new instance of the EncoderParameter class with the specified Encoder object and one 8-bit value. Sets the ValueType property to ValueTypeUndefined or ValueTypeByte, and sets the NumberOfValues property to 1.

EncoderParameter(Encoder, String)

Initializes a new instance of the EncoderParameter class with the specified Encoder object and a character string. The string is converted to a null-terminated ASCII string before it is stored in the EncoderParameter object. Sets the ValueType property to ValueTypeAscii, and sets the NumberOfValues property to the length of the ASCII string including the NULL terminator.

EncoderParameter(Encoder, Int64[])

Initializes a new instance of the EncoderParameter class with the specified Encoder object and an array of 64-bit integers. Sets the ValueType property to ValueTypeLong (32-bit), and sets the NumberOfValues property to the number of elements in the array.

EncoderParameter(Encoder, Int64)

Initializes a new instance of the EncoderParameter class with the specified Encoder object and one 64-bit integer. Sets the ValueType property to ValueTypeLong (32 bits), and sets the NumberOfValues property to 1.

EncoderParameter(Encoder, Int16[])

Initializes a new instance of the EncoderParameter class with the specified Encoder object and an array of 16-bit integers. Sets the ValueType property to ValueTypeShort, and sets the NumberOfValues property to the number of elements in the array.

EncoderParameter(Encoder, Int16)

Initializes a new instance of the EncoderParameter class with the specified Encoder object and one, 16-bit integer. Sets the ValueType property to ValueTypeShort, and sets the NumberOfValues property to 1.

EncoderParameter(Encoder, Byte[])

Initializes a new instance of the EncoderParameter class with the specified Encoder object and an array of unsigned 8-bit integers. Sets the ValueType property to ValueTypeByte, and sets the NumberOfValues property to the number of elements in the array.

EncoderParameter(Encoder, Byte[], Boolean)

Initializes a new instance of the EncoderParameter class with the specified Encoder object and an array of bytes. Sets the ValueType property to ValueTypeUndefined or ValueTypeByte, and sets the NumberOfValues property to the number of elements in the array.

EncoderParameter(Encoder, Byte)

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and one unsigned 8-bit integer. Sets the ValueType property to ValueTypeByte, and sets the NumberOfValues property to 1.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, System::Byte value);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, byte value);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * byte -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, value As Byte)

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

value
Byte

An 8-bit unsigned integer that specifies the value stored in the EncoderParameter object.

Applies to

EncoderParameter(Encoder, Int32[], Int32[], Int32[], Int32[])

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and four arrays of 32-bit integers. The four arrays represent an array rational ranges. A rational range is the set of all fractions from a minimum fractional value through a maximum fractional value. Sets the ValueType property to ValueTypeRationalRange, and sets the NumberOfValues property to the number of elements in the numerator1 array, which must be the same as the number of elements in the other three arrays.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, cli::array <int> ^ numerator1, cli::array <int> ^ denominator1, cli::array <int> ^ numerator2, cli::array <int> ^ denominator2);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, int[] numerator1, int[] denominator1, int[] numerator2, int[] denominator2);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int[] * int[] * int[] * int[] -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, numerator1 As Integer(), denominator1 As Integer(), numerator2 As Integer(), denominator2 As Integer())

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

numerator1
Int32[]

An array of 32-bit integers that specifies the numerators of the minimum values for the ranges. The integers in the array must be nonnegative.

denominator1
Int32[]

An array of 32-bit integers that specifies the denominators of the minimum values for the ranges. The integers in the array must be nonnegative.

numerator2
Int32[]

An array of 32-bit integers that specifies the numerators of the maximum values for the ranges. The integers in the array must be nonnegative.

denominator2
Int32[]

An array of 32-bit integers that specifies the denominators of the maximum values for the ranges. The integers in the array must be nonnegative.

Remarks

The ith range consists of all fractional numbers from numerator1[i]/denominator1[i] through numerator2[i]/denominator2[i].

Applies to

EncoderParameter(Encoder, Int32, Int32, Int32, Int32)

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and four, 32-bit integers. The four integers represent a range of fractions. The first two integers represent the smallest fraction in the range, and the remaining two integers represent the largest fraction in the range. Sets the ValueType property to ValueTypeRationalRange, and sets the NumberOfValues property to 1.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, int numerator1, int demoninator1, int numerator2, int demoninator2);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, int numerator1, int demoninator1, int numerator2, int demoninator2);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int * int * int * int -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, numerator1 As Integer, demoninator1 As Integer, numerator2 As Integer, demoninator2 As Integer)

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

numerator1
Int32

A 32-bit integer that represents the numerator of the smallest fraction in the range. Must be nonnegative.

demoninator1
Int32

A 32-bit integer that represents the denominator of the smallest fraction in the range. Must be nonnegative.

numerator2
Int32

A 32-bit integer that represents the denominator of the smallest fraction in the range. Must be nonnegative.

demoninator2
Int32

A 32-bit integer that represents the numerator of the largest fraction in the range. Must be nonnegative.

Applies to

EncoderParameter(Encoder, Int32, Int32)

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and a pair of 32-bit integers. The pair of integers represents a fraction, the first integer being the numerator, and the second integer being the denominator. Sets the ValueType property to ValueTypeRational, and sets the NumberOfValues property to 1.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, int numerator, int denominator);
public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, int numerator, int demoninator);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, int numerator, int denominator);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, int numerator, int demoninator);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int * int -> System.Drawing.Imaging.EncoderParameter
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int * int -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, numerator As Integer, denominator As Integer)
Public Sub New (encoder As Encoder, numerator As Integer, demoninator As Integer)

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

numerator
Int32

A 32-bit integer that represents the numerator of a fraction. Must be nonnegative.

denominatordemoninator
Int32

A 32-bit integer that represents the denominator of a fraction. Must be nonnegative.

Applies to

EncoderParameter(Encoder, Int32, Int32, Int32)

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Caution

This constructor has been deprecated. Use EncoderParameter(Encoder encoder, int numberValues, EncoderParameterValueType type, IntPtr value) instead.

Caution

This constructor has been deprecated. Use EncoderParameter(Encoder encoder, int numberValues, EncoderParameterValueType type, IntPtr value) instead. http://go.microsoft.com/fwlink/?linkid=14202

Caution

This constructor has been deprecated. Use EncoderParameter(Encoder encoder, int numberValues, EncoderParameterValueType type, IntPtr value) instead. https://go.microsoft.com/fwlink/?linkid=14202

Initializes a new instance of the EncoderParameter class with the specified Encoder object and three integers that specify the number of values, the data type of the values, and a pointer to the values stored in the EncoderParameter object.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, int NumberOfValues, int Type, int Value);
[System.Obsolete("This constructor has been deprecated. Use EncoderParameter(Encoder encoder, int numberValues, EncoderParameterValueType type, IntPtr value) instead.")]
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, int NumberOfValues, int Type, int Value);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, int NumberOfValues, int Type, int Value);
[System.Obsolete("This constructor has been deprecated. Use EncoderParameter(Encoder encoder, int numberValues, EncoderParameterValueType type, IntPtr value) instead.  http://go.microsoft.com/fwlink/?linkid=14202")]
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, int NumberOfValues, int Type, int Value);
[System.Obsolete("This constructor has been deprecated. Use EncoderParameter(Encoder encoder, int numberValues, EncoderParameterValueType type, IntPtr value) instead.  https://go.microsoft.com/fwlink/?linkid=14202")]
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, int NumberOfValues, int Type, int Value);
[<System.Obsolete("This constructor has been deprecated. Use EncoderParameter(Encoder encoder, int numberValues, EncoderParameterValueType type, IntPtr value) instead.")>]
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int * int * int -> System.Drawing.Imaging.EncoderParameter
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int * int * int -> System.Drawing.Imaging.EncoderParameter
[<System.Obsolete("This constructor has been deprecated. Use EncoderParameter(Encoder encoder, int numberValues, EncoderParameterValueType type, IntPtr value) instead.  http://go.microsoft.com/fwlink/?linkid=14202")>]
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int * int * int -> System.Drawing.Imaging.EncoderParameter
[<System.Obsolete("This constructor has been deprecated. Use EncoderParameter(Encoder encoder, int numberValues, EncoderParameterValueType type, IntPtr value) instead.  https://go.microsoft.com/fwlink/?linkid=14202")>]
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int * int * int -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, NumberOfValues As Integer, Type As Integer, Value As Integer)

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

NumberOfValues
Int32

An integer that specifies the number of values stored in the EncoderParameter object. The NumberOfValues property is set to this value.

Type
Int32

A member of the EncoderParameterValueType enumeration that specifies the data type of the values stored in the EncoderParameter object. The Type and ValueType properties are set to this value.

Value
Int32

A pointer to an array of values of the type specified by the Type parameter.

Attributes

Exceptions

Applies to

EncoderParameter(Encoder, Int32, EncoderParameterValueType, IntPtr)

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object, number of values, data type of the values, and a pointer to the values stored in the EncoderParameter object.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, int numberValues, System::Drawing::Imaging::EncoderParameterValueType type, IntPtr value);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, int numberValues, System.Drawing.Imaging.EncoderParameterValueType type, IntPtr value);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int * System.Drawing.Imaging.EncoderParameterValueType * nativeint -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, numberValues As Integer, type As EncoderParameterValueType, value As IntPtr)

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

numberValues
Int32

An integer that specifies the number of values stored in the EncoderParameter object. The NumberOfValues property is set to this value.

type
EncoderParameterValueType

A member of the EncoderParameterValueType enumeration that specifies the data type of the values stored in the EncoderParameter object. The Type and ValueType properties are set to this value.

value
IntPtr

nativeint

A pointer to an array of values of the type specified by the Type parameter.

Applies to

EncoderParameter(Encoder, Int64, Int64)

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and a pair of 64-bit integers. The pair of integers represents a range of integers, the first integer being the smallest number in the range, and the second integer being the largest number in the range. Sets the ValueType property to ValueTypeLongRange, and sets the NumberOfValues property to 1.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, long rangebegin, long rangeend);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, long rangebegin, long rangeend);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int64 * int64 -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, rangebegin As Long, rangeend As Long)

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

rangebegin
Int64

A 64-bit integer that represents the smallest number in a range of integers. Must be nonnegative. This parameter is converted to a 32-bit integer before it is stored in the EncoderParameter object.

rangeend
Int64

A 64-bit integer that represents the largest number in a range of integers. Must be nonnegative. This parameter is converted to a 32-bit integer before it is stored in the EncoderParameter object.

Applies to

EncoderParameter(Encoder, Int32[], Int32[])

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and two arrays of 32-bit integers. The two arrays represent an array of fractions. Sets the ValueType property to ValueTypeRational, and sets the NumberOfValues property to the number of elements in the numerator array, which must be the same as the number of elements in the denominator array.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, cli::array <int> ^ numerator, cli::array <int> ^ denominator);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, int[] numerator, int[] denominator);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int[] * int[] -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, numerator As Integer(), denominator As Integer())

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

numerator
Int32[]

An array of 32-bit integers that specifies the numerators of the fractions. The integers in the array must be nonnegative.

denominator
Int32[]

An array of 32-bit integers that specifies the denominators of the fractions. The integers in the array must be nonnegative. A denominator of a given index is paired with the numerator of the same index.

Applies to

EncoderParameter(Encoder, Int64[], Int64[])

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and two arrays of 64-bit integers. The two arrays represent an array integer ranges. Sets the ValueType property to ValueTypeLongRange, and sets the NumberOfValues property to the number of elements in the rangebegin array, which must be the same as the number of elements in the rangeend array.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, cli::array <long> ^ rangebegin, cli::array <long> ^ rangeend);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, long[] rangebegin, long[] rangeend);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int64[] * int64[] -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, rangebegin As Long(), rangeend As Long())

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

rangebegin
Int64[]

An array of 64-bit integers that specifies the minimum values for the integer ranges. The integers in the array must be nonnegative. The 64-bit integers are converted to 32-bit integers before they are stored in the EncoderParameter object.

rangeend
Int64[]

An array of 64-bit integers that specifies the maximum values for the integer ranges. The integers in the array must be nonnegative. The 64-bit integers are converted to 32-bit integers before they are stored in the EncoderParameters object. A maximum value of a given index is paired with the minimum value of the same index.

Applies to

EncoderParameter(Encoder, Byte, Boolean)

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and one 8-bit value. Sets the ValueType property to ValueTypeUndefined or ValueTypeByte, and sets the NumberOfValues property to 1.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, System::Byte value, bool undefined);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, byte value, bool undefined);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * byte * bool -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, value As Byte, undefined As Boolean)

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

value
Byte

A byte that specifies the value stored in the EncoderParameter object.

undefined
Boolean

If true, the ValueType property is set to ValueTypeUndefined; otherwise, the ValueType property is set to ValueTypeByte.

Applies to

EncoderParameter(Encoder, String)

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and a character string. The string is converted to a null-terminated ASCII string before it is stored in the EncoderParameter object. Sets the ValueType property to ValueTypeAscii, and sets the NumberOfValues property to the length of the ASCII string including the NULL terminator.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, System::String ^ value);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, string value);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * string -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, value As String)

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

value
String

A String that specifies the value stored in the EncoderParameter object.

Applies to

EncoderParameter(Encoder, Int64[])

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and an array of 64-bit integers. Sets the ValueType property to ValueTypeLong (32-bit), and sets the NumberOfValues property to the number of elements in the array.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, cli::array <long> ^ value);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, long[] value);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int64[] -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, value As Long())

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

value
Int64[]

An array of 64-bit integers that specifies the values stored in the EncoderParameter object. The integers in the array must be nonnegative. The 64-bit integers are converted to 32-bit integers before they are stored in the EncoderParameter object.

Applies to

EncoderParameter(Encoder, Int64)

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and one 64-bit integer. Sets the ValueType property to ValueTypeLong (32 bits), and sets the NumberOfValues property to 1.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, long value);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, long value);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int64 -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, value As Long)

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

value
Int64

A 64-bit integer that specifies the value stored in the EncoderParameter object. Must be nonnegative. This parameter is converted to a 32-bit integer before it is stored in the EncoderParameter object.

Examples

The following code example demonstrates how to create a EncoderParameter using the EncoderParameter constructor. To run this example, paste the code into a Windows Form and call the VaryQualityLevel method from the form's constructor. This example requires an image file named TestPhoto.jpg located at c:\.

private void VaryQualityLevel()
{
    // Get a bitmap.
    Bitmap bmp1 = new Bitmap(@"c:\TestPhoto.jpg");
    ImageCodecInfo jpgEncoder = GetEncoder(ImageFormat.Jpeg);

    // Create an Encoder object based on the GUID
    // for the Quality parameter category.
    System.Drawing.Imaging.Encoder myEncoder =
        System.Drawing.Imaging.Encoder.Quality;

    // Create an EncoderParameters object.
    // An EncoderParameters object has an array of EncoderParameter
    // objects. In this case, there is only one
    // EncoderParameter object in the array.
    EncoderParameters myEncoderParameters = new EncoderParameters(1);

    EncoderParameter myEncoderParameter = new EncoderParameter(myEncoder, 50L);
    myEncoderParameters.Param[0] = myEncoderParameter;
    bmp1.Save(@"c:\TestPhotoQualityFifty.jpg", jpgEncoder, myEncoderParameters);

    myEncoderParameter = new EncoderParameter(myEncoder, 100L);
    myEncoderParameters.Param[0] = myEncoderParameter;
    bmp1.Save(@"c:\TestPhotoQualityHundred.jpg", jpgEncoder, myEncoderParameters);

    // Save the bitmap as a JPG file with zero quality level compression.
    myEncoderParameter = new EncoderParameter(myEncoder, 0L);
    myEncoderParameters.Param[0] = myEncoderParameter;
    bmp1.Save(@"c:\TestPhotoQualityZero.jpg", jpgEncoder, myEncoderParameters);
}
Private Sub VaryQualityLevel()
    ' Get a bitmap.
    Dim bmp1 As New Bitmap("c:\TestPhoto.jpg")
    Dim jpgEncoder As ImageCodecInfo = GetEncoder(ImageFormat.Jpeg)

    ' Create an Encoder object based on the GUID
    ' for the Quality parameter category.
    Dim myEncoder As System.Drawing.Imaging.Encoder = System.Drawing.Imaging.Encoder.Quality

    ' Create an EncoderParameters object.
    ' An EncoderParameters object has an array of EncoderParameter
    ' objects. In this case, there is only one
    ' EncoderParameter object in the array.
    Dim myEncoderParameters As New EncoderParameters(1)

    Dim myEncoderParameter As New EncoderParameter(myEncoder, 50&)
    myEncoderParameters.Param(0) = myEncoderParameter
    bmp1.Save("c:\TestPhotoQualityFifty.jpg", jpgEncoder, myEncoderParameters)

    myEncoderParameter = New EncoderParameter(myEncoder, 100&)
    myEncoderParameters.Param(0) = myEncoderParameter
    bmp1.Save("c:\TestPhotoQualityHundred.jpg", jpgEncoder, myEncoderParameters)

    ' Save the bitmap as a JPG file with zero quality level compression.
    myEncoderParameter = New EncoderParameter(myEncoder, 0&)
    myEncoderParameters.Param(0) = myEncoderParameter
    bmp1.Save("c:\TestPhotoQualityZero.jpg", jpgEncoder, myEncoderParameters)

End Sub
private ImageCodecInfo GetEncoder(ImageFormat format)
{
    ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();

    foreach (ImageCodecInfo codec in codecs)
    {
        if (codec.FormatID == format.Guid)
        {
            return codec;
        }
    }
    
    return null;
}
Private Function GetEncoder(ByVal format As ImageFormat) As ImageCodecInfo

    Dim codecs As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders()

    Dim codec As ImageCodecInfo
    For Each codec In codecs
        If codec.FormatID = format.Guid Then
            Return codec
        End If
    Next codec
    Return Nothing

End Function

Applies to

EncoderParameter(Encoder, Int16[])

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and an array of 16-bit integers. Sets the ValueType property to ValueTypeShort, and sets the NumberOfValues property to the number of elements in the array.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, cli::array <short> ^ value);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, short[] value);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int16[] -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, value As Short())

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

value
Int16[]

An array of 16-bit integers that specifies the values stored in the EncoderParameter object. The integers in the array must be nonnegative.

Applies to

EncoderParameter(Encoder, Int16)

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and one, 16-bit integer. Sets the ValueType property to ValueTypeShort, and sets the NumberOfValues property to 1.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, short value);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, short value);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * int16 -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, value As Short)

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

value
Int16

A 16-bit integer that specifies the value stored in the EncoderParameter object. Must be nonnegative.

Applies to

EncoderParameter(Encoder, Byte[])

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and an array of unsigned 8-bit integers. Sets the ValueType property to ValueTypeByte, and sets the NumberOfValues property to the number of elements in the array.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, cli::array <System::Byte> ^ value);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, byte[] value);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * byte[] -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, value As Byte())

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

value
Byte[]

An array of 8-bit unsigned integers that specifies the values stored in the EncoderParameter object.

Applies to

EncoderParameter(Encoder, Byte[], Boolean)

Source:
EncoderParameter.cs
Source:
EncoderParameter.cs

Initializes a new instance of the EncoderParameter class with the specified Encoder object and an array of bytes. Sets the ValueType property to ValueTypeUndefined or ValueTypeByte, and sets the NumberOfValues property to the number of elements in the array.

public:
 EncoderParameter(System::Drawing::Imaging::Encoder ^ encoder, cli::array <System::Byte> ^ value, bool undefined);
public EncoderParameter (System.Drawing.Imaging.Encoder encoder, byte[] value, bool undefined);
new System.Drawing.Imaging.EncoderParameter : System.Drawing.Imaging.Encoder * byte[] * bool -> System.Drawing.Imaging.EncoderParameter
Public Sub New (encoder As Encoder, value As Byte(), undefined As Boolean)

Parameters

encoder
Encoder

An Encoder object that encapsulates the globally unique identifier of the parameter category.

value
Byte[]

An array of bytes that specifies the values stored in the EncoderParameter object.

undefined
Boolean

If true, the ValueType property is set to ValueTypeUndefined; otherwise, the ValueType property is set to ValueTypeByte.

Applies to