I want to have only black or white pixels in a resulting image. I tried the contrast and other filter methods w/o success.
I ended up with the code (pixel access) below which works for me but is slow. I don't know how to implement the code with getdata() and putdata():
for x in range(width):
for y in range(height):
pix = imgcic.getpixel((x, y))
if pix < 200:
pix = 0
else:
pix = 255
imgcic.putpixel((x,y), pix)
This is the original picture. It has some artefacts on the right top

This is the resulting picture w/o artefacts after deciding black/white based on a brightness threshold
