---
title: bitsPerPixel
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nsbitmapimagerep/bitsperpixel
---

# bitsPerPixel

The number of bits allocated for each pixel in each plane of data.

## Declaration

```swift
var bitsPerPixel: Int { get }
```

## Discussion

Discussion This number is normally equal to the number of bits per sample or, if the data is in meshed configuration, the number of bits per sample times the number of samples per pixel. It can be explicitly set to another value (in init(bitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:)) in case extra memory is allocated for each pixel. This may be the case, for example, if pixel data is aligned on byte boundaries.

## See Also

### Getting Information About Images

- [bitmapFormat](appkit/nsbitmapimagerep/bitmapformat.md)
- [NSBitmapImageRep.Format](appkit/nsbitmapimagerep/format.md)
- [bytesPerPlane](appkit/nsbitmapimagerep/bytesperplane.md)
- [bytesPerRow](appkit/nsbitmapimagerep/bytesperrow.md)
- [isPlanar](appkit/nsbitmapimagerep/isplanar.md)
- [numberOfPlanes](appkit/nsbitmapimagerep/numberofplanes.md)
- [samplesPerPixel](appkit/nsbitmapimagerep/samplesperpixel.md)
