Intervals can now be feathered at either end of the interval so that each span can blend back into the original image. Borders may now be omitted or included in the Pixel sorting. The rest of this code is never called!.Plenty of bug-fixes and speedups v1.
// This looked fine to me until I realized that you've not defined a variable k anywhere!.// I'm not sure about this next line either.// What's orig? You've not defined that anywhere.