make the optimizer remove all lower layers if the top
layers completely hide them. Since the lowest layer
cannot be removed all layers should be shifted down in
that case.
Algorithm would be something like this:
start with topmost layer, draw all non-transparet
pixels into a working tile. continue with each lower
layer until the working tile is completely solid.
remove all lower layers from that point on or cycle
layers if we are just above the first layer.
Important: This might not be desired behaviour for
work in progress maps. So it should be made clear,
that the map will remain the same optically but not
internally for editing.