<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vImage/PixelBuffer/unpremultiply()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate6vImageO11PixelBufferVAaC16Interleaved16Fx4VRszrlE13unpremultiplyyyF"
  },
  "title" : "unpremultiply()"
}
-->

# unpremultiply()

Transforms a floating-point 16-bit RGBA pixel buffer in-place from premultiplied alpha format to nonpremultiplied alpha format.

```
func unpremultiply()
```

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

For example, the following code divides the RGB values `[0.125, 0.25, 0.5]` by the alpha value `0.5`:

```swift
let pixelValues = [0.125, 0.25, 0.5,
                   Float(0.5)].map {
    return vImage.Planar16F.makePixel($0)
}

let src = vImage.PixelBuffer<vImage.Interleaved16Fx4>(
    pixelValues: pixelValues,
    size: vImage.Size(width: 1, height: 1))
    
src.unpremultiply()

let result = src.array.map {
    return vImage.PlanarF.makePixel($0)
}

// Prints "[0.25, 0.5, 1.0, 0.5]".
print(result)
```

---

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)