I don't think this is what you want, but it works (uses Opencv (which uses Numpy)):
import cv2
fname = 'Myimage.jpg'
im = cv2.imread(fname,cv2.COLOR_RGB2GRAY)
im = cv2.blur(im,(4,4))
im = cv2.threshold(im, 175 , 250, cv2.THRESH_BINARY)
im = im[1]
cv2.imshow('',im)
cv2.waitKey(0)
Output (image in the window):

You can save the image using cv2.imwrite
source
share