# ConvertTexture

> Copies the pixel data from one texture, converts the data into a different format, and copies it into another texture.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

## ConvertTexture(Texture, Texture)

Copies the pixel data from one texture, converts the data into a different format, and copies it into another texture.

```csharp
public static bool ConvertTexture(Texture src, Texture dst)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture. The [TextureDimension](/engine/6000.0/script-reference/unityengine/rendering/texturedimension.md) must be Tex2D or Cube.**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The destination texture. The [TextureDimension](/engine/6000.0/script-reference/unityengine/rendering/texturedimension.md) must be Tex2D, Tex2DArray, Cube, or CubeArray. The texture must also be uncompressed and correspond to a supported [RenderTextureFormat](/engine/6000.0/script-reference/unityengine/rendertextureformat.md).

### Returns

| Type                                                          | Description                     |
| ------------------------------------------------------------- | ------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the method succeeded. |

### Remarks

This method converts and copies pixel data from one texture to another on the GPU.

When you use `ConvertTexture`, Unity does the following:

1. Creates a temporary [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) that matches the size and format of the `dst` texture.
2. Uses [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) to copy from the `src` texture to the temporary render texture, and converts to the format of `dst`.
3. Uses [Graphics.CopyTexture](/engine/6000.0/script-reference/unityengine/graphics/copytexture.md) to copy from the temporary render texture to the `dst` texture.

This means it might be faster to convert the texture before you load it into Unity. Alternatively, if you can create `dst` as a render texture (or a graphics texture with [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled), you can use [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) instead.

You can use textures with different sizes for `src` and `dst`.

`ConvertTexture` doesn't support the following conversions:

* Cubemap to Texture2D.
* Conversions that use render targets (RenderTextures or GraphicsTextures that have [the RenderTarget flag](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled). Use [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) instead.

You can't use `ConvertTexture` if you use OpenGL with MacOS. Depending on your graphics API, you might not be able to do some types of conversions. For more information on compatibility, see [SystemInfo.copyTextureSupport](/engine/6000.0/script-reference/unityengine/systeminfo/copytexturesupport.md), [CopyTextureSupport](/engine/6000.0/script-reference/unityengine/rendering/copytexturesupport.md) and [Graphics.CopyTexture](/engine/6000.0/script-reference/unityengine/graphics/copytexture.md).

To copy the converted texture from the GPU to the CPU, use RequestIntoNativeArray.

Additional Resources: [CopyTextureSupport](/engine/6000.0/script-reference/unityengine/rendering/copytexturesupport.md).

## ConvertTexture(Texture, int, Texture, int)

Copies the pixel data from one texture, converts the data into a different format, and copies it into another texture.

```csharp
public static bool ConvertTexture(Texture src, int srcElement, Texture dst, int dstElement)
```

### Parameters

**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The source texture. The [TextureDimension](/engine/6000.0/script-reference/unityengine/rendering/texturedimension.md) must be Tex2D or Cube.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the source texture to copy from. Use [CubemapFace](/engine/6000.0/script-reference/unityengine/cubemapface.md) if `src` is a Cubemap. Set the value to `0` if `src` is a 2D texture.**** (\[Texture]\(/engine/6000.0/script-reference/unityengine/texture)): The destination texture. The [TextureDimension](/engine/6000.0/script-reference/unityengine/rendering/texturedimension.md) must be Tex2D, Tex2DArray, Cube, or CubeArray. The texture must also be uncompressed and correspond to a supported [RenderTextureFormat](/engine/6000.0/script-reference/unityengine/rendertextureformat.md).**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the source texture to copy to. For example, the [CubemapFace](/engine/6000.0/script-reference/unityengine/cubemapface.md) in a Cubemap or the slice in a texture array. Set the value to `0` if `dst` is a 2D texture.

### Returns

| Type                                                          | Description                     |
| ------------------------------------------------------------- | ------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the method succeeded. |

### Remarks

This method converts and copies pixel data from one texture to another on the GPU.

When you use `ConvertTexture`, Unity does the following:

1. Creates a temporary [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) that matches the size and format of the `dst` texture.
2. Uses [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) to copy from the `src` texture to the temporary render texture, and converts to the format of `dst`.
3. Uses [Graphics.CopyTexture](/engine/6000.0/script-reference/unityengine/graphics/copytexture.md) to copy from the temporary render texture to the `dst` texture.

This means it might be faster to convert the texture before you load it into Unity. Alternatively, if you can create `dst` as a render texture (or a graphics texture with [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled), you can use [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) instead.

You can use textures with different sizes for `src` and `dst`.

`ConvertTexture` doesn't support the following conversions:

* Cubemap to Texture2D.
* Conversions that use render targets (RenderTextures or GraphicsTextures that have [the RenderTarget flag](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled). Use [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) instead.

You can't use `ConvertTexture` if you use OpenGL with MacOS. Depending on your graphics API, you might not be able to do some types of conversions. For more information on compatibility, see [SystemInfo.copyTextureSupport](/engine/6000.0/script-reference/unityengine/systeminfo/copytexturesupport.md), [CopyTextureSupport](/engine/6000.0/script-reference/unityengine/rendering/copytexturesupport.md) and [Graphics.CopyTexture](/engine/6000.0/script-reference/unityengine/graphics/copytexture.md).

To copy the converted texture from the GPU to the CPU, use RequestIntoNativeArray.

Additional Resources: [CopyTextureSupport](/engine/6000.0/script-reference/unityengine/rendering/copytexturesupport.md).

## ConvertTexture(GraphicsTexture, GraphicsTexture)

Copies the pixel data from one texture, converts the data into a different format, and copies it into another texture.

```csharp
public static bool ConvertTexture(GraphicsTexture src, GraphicsTexture dst)
```

### Parameters

**** (\[GraphicsTexture]\(/engine/6000.0/script-reference/unityengine/rendering/graphicstexture)): The source texture. The [TextureDimension](/engine/6000.0/script-reference/unityengine/rendering/texturedimension.md) must be Tex2D or Cube.**** (\[GraphicsTexture]\(/engine/6000.0/script-reference/unityengine/rendering/graphicstexture)): The destination texture. The [TextureDimension](/engine/6000.0/script-reference/unityengine/rendering/texturedimension.md) must be Tex2D, Tex2DArray, Cube, or CubeArray. The texture must also be uncompressed and correspond to a supported [RenderTextureFormat](/engine/6000.0/script-reference/unityengine/rendertextureformat.md).

### Returns

| Type                                                          | Description                     |
| ------------------------------------------------------------- | ------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the method succeeded. |

### Remarks

This method converts and copies pixel data from one texture to another on the GPU.

When you use `ConvertTexture`, Unity does the following:

1. Creates a temporary [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) that matches the size and format of the `dst` texture.
2. Uses [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) to copy from the `src` texture to the temporary render texture, and converts to the format of `dst`.
3. Uses [Graphics.CopyTexture](/engine/6000.0/script-reference/unityengine/graphics/copytexture.md) to copy from the temporary render texture to the `dst` texture.

This means it might be faster to convert the texture before you load it into Unity. Alternatively, if you can create `dst` as a render texture (or a graphics texture with [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled), you can use [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) instead.

You can use textures with different sizes for `src` and `dst`.

`ConvertTexture` doesn't support the following conversions:

* Cubemap to Texture2D.
* Conversions that use render targets (RenderTextures or GraphicsTextures that have [the RenderTarget flag](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled). Use [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) instead.

You can't use `ConvertTexture` if you use OpenGL with MacOS. Depending on your graphics API, you might not be able to do some types of conversions. For more information on compatibility, see [SystemInfo.copyTextureSupport](/engine/6000.0/script-reference/unityengine/systeminfo/copytexturesupport.md), [CopyTextureSupport](/engine/6000.0/script-reference/unityengine/rendering/copytexturesupport.md) and [Graphics.CopyTexture](/engine/6000.0/script-reference/unityengine/graphics/copytexture.md).

To copy the converted texture from the GPU to the CPU, use RequestIntoNativeArray.

Additional Resources: [CopyTextureSupport](/engine/6000.0/script-reference/unityengine/rendering/copytexturesupport.md).

## ConvertTexture(GraphicsTexture, int, GraphicsTexture, int)

Copies the pixel data from one texture, converts the data into a different format, and copies it into another texture.

```csharp
public static bool ConvertTexture(GraphicsTexture src, int srcElement, GraphicsTexture dst, int dstElement)
```

### Parameters

**** (\[GraphicsTexture]\(/engine/6000.0/script-reference/unityengine/rendering/graphicstexture)): The source texture. The [TextureDimension](/engine/6000.0/script-reference/unityengine/rendering/texturedimension.md) must be Tex2D or Cube.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the source texture to copy from. Use [CubemapFace](/engine/6000.0/script-reference/unityengine/cubemapface.md) if `src` is a Cubemap. Set the value to `0` if `src` is a 2D texture.**** (\[GraphicsTexture]\(/engine/6000.0/script-reference/unityengine/rendering/graphicstexture)): The destination texture. The [TextureDimension](/engine/6000.0/script-reference/unityengine/rendering/texturedimension.md) must be Tex2D, Tex2DArray, Cube, or CubeArray. The texture must also be uncompressed and correspond to a supported [RenderTextureFormat](/engine/6000.0/script-reference/unityengine/rendertextureformat.md).**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The element in the source texture to copy to. For example, the [CubemapFace](/engine/6000.0/script-reference/unityengine/cubemapface.md) in a Cubemap or the slice in a texture array. Set the value to `0` if `dst` is a 2D texture.

### Returns

| Type                                                          | Description                     |
| ------------------------------------------------------------- | ------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the method succeeded. |

### Remarks

This method converts and copies pixel data from one texture to another on the GPU.

When you use `ConvertTexture`, Unity does the following:

1. Creates a temporary [RenderTexture](/engine/6000.0/script-reference/unityengine/rendertexture.md) that matches the size and format of the `dst` texture.
2. Uses [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) to copy from the `src` texture to the temporary render texture, and converts to the format of `dst`.
3. Uses [Graphics.CopyTexture](/engine/6000.0/script-reference/unityengine/graphics/copytexture.md) to copy from the temporary render texture to the `dst` texture.

This means it might be faster to convert the texture before you load it into Unity. Alternatively, if you can create `dst` as a render texture (or a graphics texture with [GraphicsTextureDescriptorFlags.RenderTarget](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled), you can use [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) instead.

You can use textures with different sizes for `src` and `dst`.

`ConvertTexture` doesn't support the following conversions:

* Cubemap to Texture2D.
* Conversions that use render targets (RenderTextures or GraphicsTextures that have [the RenderTarget flag](/engine/6000.0/script-reference/unityengine/rendering/graphicstexturedescriptorflags/rendertarget.md) enabled). Use [Graphics.Blit](/engine/6000.0/script-reference/unityengine/graphics/blit.md) instead.

You can't use `ConvertTexture` if you use OpenGL with MacOS. Depending on your graphics API, you might not be able to do some types of conversions. For more information on compatibility, see [SystemInfo.copyTextureSupport](/engine/6000.0/script-reference/unityengine/systeminfo/copytexturesupport.md), [CopyTextureSupport](/engine/6000.0/script-reference/unityengine/rendering/copytexturesupport.md) and [Graphics.CopyTexture](/engine/6000.0/script-reference/unityengine/graphics/copytexture.md).

To copy the converted texture from the GPU to the CPU, use RequestIntoNativeArray.

Additional Resources: [CopyTextureSupport](/engine/6000.0/script-reference/unityengine/rendering/copytexturesupport.md).
