If you're always going from grey to tinted, then the easiest way is to treat it as a 'P' image with a special palette.
I believe this function will prepare the palette:
def make_palette(tr, tg, tb):
l = []
for i in range(255):
l.extend([tr*i / 255, tg*i / 255, tb*i / 255])
return l
Here's an example:
import Image
A, B, C = map(chr, [64, 128, 192])
i = Image.fromstring(
'P', (4,4), ''.join([
B,B,B,B,
B,C,C,A,
B,C,C,A,
B,A,A,A]))
i.putpalette(make_palette(64,64,255))
i.show()
Jeff
pgp0XmK9KEsfO.pgp
Description: PGP signature
-- http://mail.python.org/mailman/listinfo/python-list
