Spawn objects from picture isnt working

Gonna spawn 3d objects from 2dTexture by checking pixel color, but if i run the script it is just randomly spawning some objects. Tried it without “if” statement and it spawned big cube. So the problem in that statement. Help pls!`
{

public Texture2D map;
public PrefabInstantiate[] ColorToPrefab;
void Start () {
    map = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/Maps/Map.jpg", typeof(Texture2D));
    LvlGenerator();
}

void LvlGenerator()
{
    
    for (int z = 0; z < map.width; z++)
    {
        for (int y = 0; y < map.height; y++)
        {
            GetColor(z,y);
        }
    }
}

void GetColor(int z,int y)
{
    Color pixelColor = map.GetPixel(z, y);
    if (pixelColor.r == 255 && pixelColor.b == 255 && pixelColor.g == 255 && pixelColor.a == 255) 
    {
        return;
    }

    foreach (PrefabInstantiate ColorToPrefabs in ColorToPrefab)
    {
        if (ColorToPrefabs.color == pixelColor)
        {
            Vector3 spawnPoint = new Vector3(0 , y, z+25f);
            Instantiate(ColorToPrefabs.prefab, spawnPoint, Quaternion.identity);
        }
    }
}

}

public class PrefabInstantiate
{
    public Color color;
    public GameObject prefab;
}
  1. What is the content of “ColorToPrefab”?
  2. “Texture coordinates start at lower left corner.” - does it make sense?
  3. You mentioned “just randomly spawning some objects” - is it a problem with positions or spawned object prefabs?
  4. Do colors in “Map.jpg” exactly match colors in “ColorToPrefab” taking into account lossy nature of JPEG format?
  5. No idea why it spawns the “big cube”.