It works like this: It starts at the top left and goes to the bottom right. Everytime it finds a solid object which isn't already used it will create a rectangle with the largest possible area from that position. Then the tiles used in that rectangle won't be able to be used again.
I thought I'd make a seperate issue for this, since it didn't seem like you saw it in the main issue.
Anyway I made my own kind of algorithm recently and while it's not perfect, it works alright. Result is here: http://jimvliet.github.io/HTML5-Game/objectConverter
The code is in this file: https://github.com/JimVliet/HTML5-Game/blob/master/scripts/functionFile.ts
It works like this: It starts at the top left and goes to the bottom right. Everytime it finds a solid object which isn't already used it will create a rectangle with the largest possible area from that position. Then the tiles used in that rectangle won't be able to be used again.
If you have any questions, feel free to ask.
This is my current game: http://jimvliet.github.io/HTML5-Game/ in which this is used