like floodfillgray.py but faster
resizeAndWrite.py improved