# dxGetPixelColor (Client)

> Reads the colour of one pixel of a `plain` image.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Screen drawing
- **URL**: https://wiki.mymp.gg/en/dxGetPixelColor

## Syntax

```lua
int, int, int, int|false dxGetPixelColor(string pixels, int x, y)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `pixels` | `string` | The pixels in `plain`. |
| `x, y` | `int` | Position of the pixel, from 0. A vec2 also works. |

## Returns

Red, green, blue and alpha (0 to 255), or `false` when the pixels are not `plain` or the point is outside the image.

## Example

```lua
local target = dxCreateRenderTarget(64, 64)

dxGetTexturePixels(target, function(pixels)
    if not pixels then return end
    local r, g, b, a = dxGetPixelColor(pixels, 32, 32)
    print(r, g, b, a)
end)
```

## See also

- [dxSetPixelColor (Client)](https://wiki.mymp.gg/en/dxSetPixelColor.md): Changes the colour of one pixel of a plain image, in the string itself.
- [dxGetTexturePixels (Client)](https://wiki.mymp.gg/en/dxGetTexturePixels.md): Reads an image's pixels and hands them to a function, a few frames later.
- [dxGetPixelsSize (Client)](https://wiki.mymp.gg/en/dxGetPixelsSize.md): Returns the width and height of an image held in a string (plain, png, jpeg or dds).
