import matplotlib.pyplot as plt
import matplotlib.image as mpimg
# Replace 'path_to_image.png' with the actual path to your image file
image = mpimg.imread('path_to_image.png')
# Assuming you want to read the RGB values of the pixel at coordinates (x, y)
x, y = 100, 200 # Replace with the desired pixel coordinates
# Access the RGB values of the pixel at (x, y) using array indexing
# The RGB values will be in the range of 0 to 1 (float)
pixel_rgb = image[y, x]
# Convert the RGB values to the range of 0 to 255 (integer)
pixel_rgb_int = (pixel_rgb * 255).astype(int)
# Print the RGB values
print("RGB values at pixel (", x, ",", y, "):", pixel_rgb_int)