<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShaders",
  "identifier" : "/documentation/MetalPerformanceShaders/MPSImageConversion",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Metal Performance Shaders"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSImageConversion"
  },
  "title" : "MPSImageConversion"
}
-->

# MPSImageConversion

A filter that performs a conversion of color space, alpha, or pixel format.

```
class MPSImageConversion
```

## Overview

An [`MPSImageConversion`](/documentation/MetalPerformanceShaders/MPSImageConversion) filter allows you to change the alpha encoding or color space of an image. For example, you can convert an image with a premultiplied alpha to non-premultiplied, or change the color space from one variant to another.

As with all Metal Performance Shaders filters, the conversion filter allows for source and destination textures with different pixel formats and, in that case, will convert the source texture’s format to the destination texture’s format. See [Supported Pixel Formats for Image Kernels](/documentation/MetalPerformanceShaders/image-filters#Supported-Pixel-Formats-for-Image-Kernels) for a list of supported pixel formats.

The following listing shows how you can create an image conversion filter to map the color intensity from the sRGB color space to a linear gamma curve.

Listing 1. Mapping color intensity from the sRGB color space to a linear gamma curve.

```swift
guard let srcColorSpace = CGColorSpace(name: CGColorSpace.sRGB),
    let dstColorSpace = CGColorSpace(name: CGColorSpace.linearSRGB),
    let device = MTLCreateSystemDefaultDevice() else {
        return
}
     
let conversionInfo = CGColorConversionInfo(src: srcColorSpace,
                                           dst: dstColorSpace)
     
let conversion = MPSImageConversion(device: device,
                                    srcAlpha: .alphaIsOne,
                                    destAlpha: .alphaIsOne,
                                    backgroundColor: nil,
                                    conversionInfo: conversionInfo)
```

## Topics

### Methods

[`init(device:srcAlpha:destAlpha:backgroundColor:conversionInfo:)`](/documentation/MetalPerformanceShaders/MPSImageConversion/init(device:srcAlpha:destAlpha:backgroundColor:conversionInfo:))

Initializes a filter that can convert texture color space, alpha, and pixel format.

[`MPSAlphaType`](/documentation/MetalPerformanceShaders/MPSAlphaType)

Premultiplication description for the color channels of an image.

### Properties

[`sourceAlpha`](/documentation/MetalPerformanceShaders/MPSImageConversion/sourceAlpha)

Premultiplication description for the source texture.

[`destinationAlpha`](/documentation/MetalPerformanceShaders/MPSImageConversion/destinationAlpha)

Premultiplication description for the destination texture.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)