Developing the Multi Thresholds filter

You wrote that you have a solution for PS.
Why do you need a different solution?
For Gimp you can try: