I've been searching all over the internet for a method to convert an 
image to a 8 color (3-bit) image. I've used these:

Based on brightness but not good results:
palette = []
for i in range(32):
    palette.extend([0, 0, 0])
for i in range(32):
    palette.extend([0, 0, 255])
for i in range(32):
    palette.extend([0, 255, 0])
for i in range(32):
    palette.extend([0, 255, 255])
for i in range(32):
    palette.extend([255, 0, 0])
for i in range(32):
    palette.extend([255, 0, 255])
for i in range(32):
    palette.extend([255, 255, 0])
for i in range(32):
    palette.extend([255, 255, 255])

Outputs a grayscale image because it fills the rest of the palette with 
black, grays and whites:
palette = [(0,0,0)] * 8
palette[1] = (0, 0, 255)
palette[2] = (0, 255, 0)
palette[3] = (0, 255, 255)
palette[4] = (255, 0, 0)
palette[5] = (255, 0, 255)
palette[6] = (255, 255, 0)
palette[7] = (255, 255, 255)

I am trying find a method to output a resonable image which would look 
like the one in
http://en.wikipedia.org/wiki/List_of_monochrome_and_RGB_palettes#3-bit_RGB

Do you have any advices?

Thank you,

Gokce

_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to