labeled_img = measure.label(img)
labels = np.unique(labeled_img)
newimg = np.zeros((img.shape[0], img.shape[1]))
for label in labels:
    if np.sum(labeled_img == label) < 250:
        newimg = newimg + (labeled_img == label)
io.imshow(newimg)
io.show()
Get rid of a large blob in a binary image but keep smaller blobs in python with PIL or skimage