Is the given x, y pixel coordinates within the resolution of the image.
x
y
bool boundsSafe(int x, int y) => x >= 0 && x < width && y >= 0 && y < height;