<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSBitmapImageRep/getPixel(_:atX:y:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSBitmapImageRep(im)getPixel:atX:y:"
  },
  "title" : "getPixel(_:atX:y:)"
}
-->

# getPixel(_:atX:y:)

Returns by indirection the pixel data for the specified location in the bitmap image representation.

```
func getPixel(_ p: UnsafeMutablePointer<Int>, atX x: Int, y: Int)
```

## Parameters

`p`

On return, an array of integers containing raw pixel data in the appropriate order according to the object’s bitmap format. Smaller integer samples, such as 4-bit, are returned as an integer. Floating point values are cast to integer values and returned.

`x`

The x-axis coordinate of the pixel.

`y`

The y-axis coordinate of the pixel.

## Discussion

The origin is in the top-left corner.

## See Also

[`bitmapFormat`](/documentation/AppKit/NSBitmapImageRep/bitmapFormat)

The format of the bitmap image representation.



---

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)