PathFinding this kind of pathfinding algorithm framework, how to generate the matrix needed?

I would like to ask you guys, in game development, characters find their way in maps. In the framework of pathfinding algorithms like PathFinding.js, the map matrix needed is generated immediately during the pathfinding operation, or corresponding to the map generated in advance

.
var matrix = [
    [0, 0, 0, 1, 0],
    [1, 0, 0, 0, 1],
    [0, 0, 1, 0, 0],
];
var grid = new PF.Grid(matrix);

if it is generated in advance, how is this matrix generated? is there any tool, such as opening a map picture, drawing a movable area, and then automatically generating the corresponding matrix file?

Menu