I need to convert series of images drawn as white on black background letters to images where white and black are inverted (as negative). How can I achieve this using PIL?
+3
A:
Try the following from the docs: http://www.pythonware.com/library/pil/handbook/imageops.htm
from PIL import Image
import PIL.ImageOps
image = Image.open('your_image.png')
inverted_image = PIL.ImageOps.invert(image)
inverted_image.save('new_name.png')
Note: "The ImageOps module contains a number of 'ready-made' image processing operations. This module is somewhat experimental, and most operators only work on L and RGB images."
PreludeAndFugue
2010-03-23 10:01:24
Oh, it seems I've missed that module. Thanks.
bialix
2010-03-23 13:33:34
A:
Is there another way. but using numbers so saying white (0) change to black(255)
SYC
2010-05-16 11:28:48