Auto Changing Spacing Based On Grayscale Value

works fine, choose parameters carefully