[Image-SIG] Image.convert() doesn't dither?

Bill Janssen janssen at parc.com
Tue Oct 25 02:39:07 CEST 2005


The PIL manual says that calling image.convert('1') on a greyscale
image will threshold the image (fairly starkly: "all non-zero values
are set to 255 (white).")  However, when I try this on a test page of
color blocks, I seem to get Floyd-Steinberg dithering instead.

The code sequence I use is:


	import Image, ImageOps

	im = Image.open(infilename)
	if im.mode == 'RGB':
	    im = ImageOps.grayscale(im)
	if im.mode == 'L':
	    im = ImageOps.autocontrast(im)
	    im = im.convert('1')
	im.save(outfilename, 'TIFF')

Is the documentation out of date?

If I want thresholding, is there a now a way to do it without using
"point"?  Using quantize(), perhaps?

Is there a difference between Image.convert('L') and
ImageOps.grayscale()?

Bill


More information about the Image-SIG mailing list