---
title: "unpremultiply(channelOrdering:)"
framework: accelerate
role: symbol
role_heading: Instance Method
path: "accelerate/vimage/pixelbuffer/unpremultiply(channelordering:)-19l0s"
---

# unpremultiply(channelOrdering:)

Transforms an unsigned 16-bit ARGB or RGBA pixel buffer in-place from premultiplied alpha format to nonpremultiplied alpha format.

## Declaration

```swift
func unpremultiply(channelOrdering: vImage.ChannelOrdering)
```

## Parameters

- `channelOrdering`: The channel ordering of the source buffer.

## Discussion

Discussion This function divides the color values in each pixel self by the corresponding alpha value and copies the alpha value to the destination unchanged. The function treats the values 0 ... UInt16.max in the pixel buffer as the values 0 ... 1. For example, the following code divides the RGB values [UInt16.max / 8, UInt16.max / 4, UInt16.max / 2] by the alpha value UInt16.max / 2: let src = vImage.PixelBuffer<vImage.Interleaved16Ux4>(     pixelValues: [UInt16.max / 2,                   UInt16.max / 8, UInt16.max / 4, UInt16.max / 2],     size: vImage.Size(width: 1, height: 1))

src.unpremultiply(channelOrdering: .ARGB)

// Prints "[32767, 16383, 32767, 65535]" //  ≅ [UInt16.max / 2, UInt16.max / 4, UInt16.max / 2, UInt16.max] print(src.array)

## See Also

### Unpremultiply

- [unpremultiply(alpha:)](accelerate/vimage/pixelbuffer/unpremultiply(alpha:)-xnog.md)
- [unpremultiply(alpha:)](accelerate/vimage/pixelbuffer/unpremultiply(alpha:)-i0ri.md)
- [unpremultiply(channelOrdering:)](accelerate/vimage/pixelbuffer/unpremultiply(channelordering:)-1pkat.md)
- [unpremultiply()](accelerate/vimage/pixelbuffer/unpremultiply().md)
- [unpremultiply(channelOrdering:)](accelerate/vimage/pixelbuffer/unpremultiply(channelordering:)-82uq3.md)
