What is the function in PHP to retrieve the color of a pixel in an image?

To retrieve the color of a pixel in an image in PHP, you can use the `imagecolorat()` function. This function takes the image resource and the x, y coordinates of the pixel as parameters, and returns the color index of that pixel. You can then use the `imagecolorsforindex()` function to get the RGB values of the color index.

// Load the image
$image = imagecreatefromjpeg('image.jpg');

// Get the color index of a pixel at x=100, y=50
$color_index = imagecolorat($image, 100, 50);

// Get the RGB values of the color index
$rgb = imagecolorsforindex($image, $color_index);

// Output the RGB values
echo 'Red: ' . $rgb['red'] . ', Green: ' . $rgb['green'] . ', Blue: ' . $rgb['blue'];

// Free up memory
imagedestroy($image);