<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vImageConvert_BGR888toBGRA8888",
  "metadataVersion" : "0.1.0",
  "role" : "Macro",
  "symbol" : {
    "kind" : "Macro",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@macro@vImageConvert_BGR888toBGRA8888"
  },
  "title" : "vImageConvert_BGR888toBGRA8888"
}
-->

# vImageConvert_BGR888toBGRA8888

Combines an 8-bit-per-channel, 3-channel BGR buffer and either an 8-bit alpha buffer or constant alpha value to produce a BGRA result.

```
#define vImageConvert_BGR888toBGRA8888(_bgrSrc, _aSrc, _alpha, _bgraDest, _premultiply, _flags)
```

## Parameters

`_bgrSrc`

The source vImage buffer that contains the blue, green, and red channels.

`_aSrc`

The source vImage buffer that contains the alpha channel. Set this value to `nil` to specify that the function sets the destination alpha as the constant destination alpha value.

`_alpha`

The constant destination alpha value. The function ignores this paramater if the `aSrc` parameter isn’t `nil`.

`_bgraDest`

A pointer to the destination vImage buffer structure. You’re responsible for filling out the [`height`](/documentation/Accelerate/vImage_Buffer/height), [`width`](/documentation/Accelerate/vImage_Buffer/width), and [`rowBytes`](/documentation/Accelerate/vImage_Buffer/rowBytes) fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer this structure points to contains the destination image data. When you no longer need the data buffer, deallocate the memory to prevent memory leaks.

`_premultiply`

A Boolean value that specifes whether the function premultiplies the color channels by the alpha channel.

`_flags`

The options to use when performing the operation. If your code implements its own tiling or its own multithreading, pass [`kvImageDoNotTile`](/documentation/Accelerate/kvImageDoNotTile); otherwise, pass [`kvImageNoFlags`](/documentation/Accelerate/kvImageNoFlags).

## Return Value

[`kvImageNoError`](/documentation/Accelerate/kvImageNoError); otherwise, one of the error codes in <doc://com.apple.documentation/documentation/Accelerate/data-types-and-constants>.

## Discussion

If you specify `premultiply` as `true`, the function uses the following calculation to perform the conversion:

```objc
 b = (a * b + 127) / 255
 g = (a * g + 127) / 255
 r = (a * r + 127) / 255
```

---

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)