GIS2BIM Image from Tile combine

Hello everyone,
After I have retrieved the pictures (tile) from the Internet, I now try to combine the photos. It works well when the photos are in a row. But if the photos are in several rows, the Python script still puts all the photos in a row.

Could you please help me edit python script to put the photos in the right place

The aim is to get a combined photo.
I am very grateful for your help

Uploading: Test Tile Image combine…dyn…
Test Tile Image combine…dyn (201.9 KB)