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

# samplesPerPixel

The number of components for each pixel.

```
var samplesPerPixel: Int { get }
```

## Discussion

This property reflects both the number of color components and the coverage component, if present.

## See Also

[`bitsPerSample`](/documentation/AppKit/NSImageRep/bitsPerSample)

The number of bits per sample in the object (if the object is a planar image, this property contains the number of bits per sample per plane).



---

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)