> 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.imageconverter.md).

# ImageConverter

Namespace: **System.Drawing**

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

Provides a type converter to convert [Image](/system.drawing.managed/api/system.drawing/system.drawing.image.md) objects to and from various other representations. This class supports conversion from byte arrays to [Image](/system.drawing.managed/api/system.drawing/system.drawing.image.md) objects and vice versa.

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

```csharp
public class ImageConverter : TypeConverter
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

## Constructors

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

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

## Methods

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

Determines whether this converter can convert an object of the specified type to an [Image](/system.drawing.managed/api/system.drawing/system.drawing.image.md), using the specified context.

| Parameter      | Type                                                                                                         | Description                                                                                                                                     |
| -------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| **context**    | [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) | An [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) that provides a format context. |
| **sourceType** | [Type](https://docs.microsoft.com/dotnet/api/system.type)                                                    | The [Type](https://docs.microsoft.com/dotnet/api/system.type) to evaluate for conversion.                                                       |

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

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

Determines whether this converter can convert an [Image](/system.drawing.managed/api/system.drawing/system.drawing.image.md) to the specified type, using the specified context.

| Parameter           | Type                                                                                                         | Description                                                                                                                                     |
| ------------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| **context**         | [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) | An [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) that provides a format context. |
| **destinationType** | [Type](https://docs.microsoft.com/dotnet/api/system.type)                                                    | The [Type](https://docs.microsoft.com/dotnet/api/system.type) to evaluate for conversion.                                                       |

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

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

Converts the given object to an [Image](/system.drawing.managed/api/system.drawing/system.drawing.image.md) object, using the specified context and culture information.

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

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). An [Image](/system.drawing.managed/api/system.drawing/system.drawing.image.md) object, or if the conversion cannot be performed.

**Throws:**

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

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

Converts the given [Image](/system.drawing.managed/api/system.drawing/system.drawing.image.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 [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) that provides a format context. |
| **culture**         | [CultureInfo](https://docs.microsoft.com/dotnet/api/system.globalization.cultureinfo)                        | The [CultureInfo](https://docs.microsoft.com/dotnet/api/system.globalization.cultureinfo) to use during conversion.                             |
| **value**           | [Object](https://docs.microsoft.com/dotnet/api/system.object)                                                | The [Image](/system.drawing.managed/api/system.drawing/system.drawing.image.md) object to convert.                                              |
| **destinationType** | [Type](https://docs.microsoft.com/dotnet/api/system.type)                                                    | The [Type](https://docs.microsoft.com/dotnet/api/system.type) to convert the object to.                                                         |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). The converted object.

**Throws:**

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

### ![](/files/gN3G3VR5GgQngV3jdnfJ) GetProperties(context, value, attributes)

Retrieves the set of properties for the [Image](/system.drawing.managed/api/system.drawing/system.drawing.image.md) type. By default, this method returns the properties of the [Image](/system.drawing.managed/api/system.drawing/system.drawing.image.md) type.

| Parameter      | Type                                                                                                         | Description                                                                                                                                     |
| -------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| **context**    | [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) | An [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) that provides a format context. |
| **value**      | [Object](https://docs.microsoft.com/dotnet/api/system.object)                                                | The object to retrieve properties for.                                                                                                          |
| **attributes** | [Attribute\[\]](https://docs.microsoft.com/dotnet/api/system.attribute)                                      | An array of [Attribute](https://docs.microsoft.com/dotnet/api/system.attribute) objects to filter the properties.                               |

**Returns:** [PropertyDescriptorCollection](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptorcollection). A [PropertyDescriptorCollection](https://docs.microsoft.com/dotnet/api/system.componentmodel.propertydescriptorcollection) containing the properties of the [Image](/system.drawing.managed/api/system.drawing/system.drawing.image.md) type.

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

Determines whether this object supports properties. This implementation always returns .

| Parameter   | Type                                                                                                         | Description                                                                                                                                     |
| ----------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| **context** | [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) | An [ITypeDescriptorContext](https://docs.microsoft.com/dotnet/api/system.componentmodel.itypedescriptorcontext) that provides a format context. |

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


---

# 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.imageconverter.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.
