<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSImageRep/hasAlpha",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSImageRep(py)alpha"
  },
  "title" : "hasAlpha"
}
-->

# hasAlpha

A Boolean value that indicates whether the image data has an alpha channel.

```
var hasAlpha: Bool { get set }
```

## Discussion

The value of this property is <doc://com.apple.documentation/documentation/Swift/true> if the receiver has a known alpha channel; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

Subclasses can set this property when loading image data to notify the parent class whether that data contains an alpha component. Specifying a value of <doc://com.apple.documentation/documentation/Swift/true> does not add an alpha channel to the image data itself; it merely records the fact that the data has an alpha channel.

---

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)