Apr-06-2017, 12:59 PM
To round to nearest N:
* add N/2
* integer-divide by N
* multiply by N
* add N/2
* integer-divide by N
* multiply by N
def round(x,N): return ( (x+N/2) // N) * N
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Your one-stop place for all your GIMP needs: gimp-forum.net