image_get_pixel()

Returns the RGB color value of a specific pixel in an image.

Extracts the pixel color from an image object at the specified (x, y) position.

Syntax

planetcnc.image_get_pixel(image, x, y)

Parameters

Parameter Type Description Comment
image capsule Image object capsule.
x int X coordinate of the pixel.
y int Y coordinate of the pixel.

Return Value

Examples

#! /usr/bin/env python
 
import planetcnc
 
# Assuming 'img' is a valid image capsule object
r, g, b = planetcnc.image_get_pixel(img, 10, 20)
print(f"Pixel color at (10,20): R={r}, G={g}, B={b}")

See also

image_open
image_open_data
image_close
image_save
image_size
image_get_pixel
image_get_pixel_gray
image_to_cam
image_from_cam