views:

446

answers:

2

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
Oh, it seems I've missed that module. Thanks.
bialix
A: 

Is there another way. but using numbers so saying white (0) change to black(255)

SYC