Local Maximum function strange behavior

Godot Version

4.3 C#

Question

I wrote this function that checks if a given location is a local Minimum or Maximum however it keeps returning images with maximums in clumps which should be impossible by definition there should be at least one pixel separating each one at a minimum. Here is the relevant code.

private List<Vector2> GetNeighbors(int x, int y)
	{
		List<Vector2> neighbors = new();

		if (x - 1 >= 0) // WEST
		{
			neighbors.Add(new Vector2(x-1,y));
		}
		if (x - 1 >= 0 && y - 1 >= 0) // NORTHWEST
		{
			neighbors.Add(new Vector2(x-1,y-1));
		}
		if (y - 1 >= 0) // NORTH
		{
			neighbors.Add(new Vector2(x,y-1));
		}
		if (x + 1 <= worldWidth - 1 && y - 1 >= 0) // NORTHEAST
		{
			neighbors.Add(new Vector2(x+1,y-1));
		}
		if (x + 1 <= worldWidth - 1) // EAST
		{
			neighbors.Add(new Vector2(x+1,y));
		}
		if (x + 1 <= worldWidth - 1 && y + 1 <= worldHeight - 1) // SOUTHEAST
		{
			neighbors.Add(new Vector2(x+1,y));
		}
		if (y + 1 <= worldHeight - 1) // SOUTH
		{
			neighbors.Add(new Vector2(x,y+1));
		}
		if (x - 1 >= 0 && y + 1 <= worldHeight - 1) // SOUTHWEST
		{
			neighbors.Add(new Vector2(x-1,y+1));
		}

		return neighbors;
	}
private void CheckMaximaMinima(int x,int y,float value)
	{
		List<Vector2> neighbors = GetNeighbors(x,y);
		List<bool> values = new();

		for (int i = 0;i<neighbors.Count;i++)
		{
			float compareValue = noiseImage.GetPixel((int)neighbors[i].X,(int)neighbors[i].Y).Luminance;

			if (compareValue < (value + maxminThreshold))
			{
				values.Add(true);
			}
			else
			{
				values.Add(false);
			}
		}

		if (values.All(item => item == true))
		{
			planetImage.SetPixel(x,y,colorMaxima);
		}
		else if (values.All(item => item == false))
		{
			planetImage.SetPixel(x,y,colorMinima);
		}
	}

And here is the output


Is there something wrong with the code or a better solution? Any advice is welcome.