> For the complete documentation index, see [llms.txt](https://docs.wisej.com/system.drawing.managed/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/system.drawing.managed/api/system.drawing/system.drawing.imageformatconverter.md).

# ImageFormatConverter

Namespace: **System.Drawing**

Assembly: **System.Drawing.Managed** (4.0.0.0)

Provides a type converter to convert [ImageFormat](/system.drawing.managed/api/system.drawing.imaging/system.drawing.imaging.imageformat.md) objects to and from various other representations, such as strings and instance descriptors.

{% tabs %}
{% tab title="C#" %}

```csharp
public class ImageFormatConverter : TypeConverter
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class ImageFormatConverter
    Inherits TypeConverter
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](/files/gN3G3VR5GgQngV3jdnfJ) ImageFormatConverter()

Initializes a new instance of [ImageFormatConverter](/system.drawing.managed/api/system.drawing/system.drawing.imageformatconverter.md).

## Methods

### ![](/files/gN3G3VR5GgQngV3jdnfJ) CanConvertFrom(context, sourceType)

Returns whether this converter can convert an object of the given type to an [ImageFormat](/system.drawing.managed/api/system.drawing.imaging/system.drawing.imaging.imageformat.md), using the specified context.

| Parameter      | Type                                                                                                         | Description                                                         |
| -------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
| **context**    | [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) | An optional format context that can provide additional information. |
| **sourceType** | [Type](https://docs.microsoft.com/dotnet/api/system.type)                                                    | The type to convert from.                                           |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). `true` if conversion is possible; otherwise, `false`.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) CanConvertTo(context, destinationType)

Returns whether this converter can convert an [ImageFormat](/system.drawing.managed/api/system.drawing.imaging/system.drawing.imaging.imageformat.md) to the specified destination type, using the given context.

| Parameter           | Type                                                                                                         | Description                                                         |
| ------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
| **context**         | [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) | An optional format context that can provide additional information. |
| **destinationType** | [Type](https://docs.microsoft.com/dotnet/api/system.type)                                                    | The type to convert to.                                             |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). `true` if conversion is possible; otherwise, `false`.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) ConvertFrom(context, culture, value)

Converts the specified value to an [ImageFormat](/system.drawing.managed/api/system.drawing.imaging/system.drawing.imaging.imageformat.md) object, using the provided context and culture information.

| Parameter   | Type                                                                                                         | Description                                                         |
| ----------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
| **context** | [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) | An optional format context that can provide additional information. |
| **culture** | [CultureInfo](https://docs.microsoft.com/dotnet/api/system.globalization.cultureinfo)                        | The culture to use for conversion.                                  |
| **value**   | [Object](https://docs.microsoft.com/dotnet/api/system.object)                                                | The value to convert.                                               |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). An [ImageFormat](/system.drawing.managed/api/system.drawing.imaging/system.drawing.imaging.imageformat.md) object that represents the converted value.

**Throws:**

* [FormatException](https://docs.microsoft.com/dotnet/api/system.formatexception) Thrown if the value cannot be converted to an [ImageFormat](/system.drawing.managed/api/system.drawing.imaging/system.drawing.imaging.imageformat.md).

### ![](/files/gN3G3VR5GgQngV3jdnfJ) ConvertTo(context, culture, value, destinationType)

Converts the given [ImageFormat](/system.drawing.managed/api/system.drawing.imaging/system.drawing.imaging.imageformat.md) object to another type, using the specified context and culture information.

| Parameter           | Type                                                                                                         | Description                                                                                                                    |
| ------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
| **context**         | [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) | An optional format context that can provide additional information.                                                            |
| **culture**         | [CultureInfo](https://docs.microsoft.com/dotnet/api/system.globalization.cultureinfo)                        | The culture to use for conversion.                                                                                             |
| **value**           | [Object](https://docs.microsoft.com/dotnet/api/system.object)                                                | The [ImageFormat](/system.drawing.managed/api/system.drawing.imaging/system.drawing.imaging.imageformat.md) object to convert. |
| **destinationType** | [Type](https://docs.microsoft.com/dotnet/api/system.type)                                                    | The type to convert to.                                                                                                        |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). An object representing the converted value.

**Throws:**

* [NotSupportedException](https://docs.microsoft.com/dotnet/api/system.notsupportedexception) Thrown if the conversion cannot be performed.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) GetStandardValues(context)

Returns a collection of standard [ImageFormat](/system.drawing.managed/api/system.drawing.imaging/system.drawing.imaging.imageformat.md) values supported by this converter.

| Parameter   | Type                                                                                                         | Description                                                         |
| ----------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
| **context** | [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) | An optional format context that can provide additional information. |

**Returns:** [StandardValuesCollection](https://docs.microsoft.com/dotnet/api/system.componentmodel.standardvaluescollection). A [StandardValuesCollection](https://docs.microsoft.com/dotnet/api/system.componentmodel.typeconverter.standardvaluescollection) containing the standard [ImageFormat](/system.drawing.managed/api/system.drawing.imaging/system.drawing.imaging.imageformat.md) values, or `null` if the data type does not support a standard set of values.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) GetStandardValuesSupported(context)

Returns whether this object supports a standard set of values that can be picked from a list.

| Parameter   | Type                                                                                                         | Description                                                         |
| ----------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
| **context** | [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) | An optional format context that can provide additional information. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). `true` if standard values are supported; otherwise, `false`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wisej.com/system.drawing.managed/api/system.drawing/system.drawing.imageformatconverter.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
