BOM and accessibility

Nov 08, 2010 18:25

The BOM publishes weather radar data online. This is awesome. The palette they use is practically useless for colour-blind people. This is NOT awesome.

The luminance of the scale they use is all over the place. Here is a sample image., and here is the same image in black and white. See how easy it is to make out without relying on hue? Although I can see colours, the scale at the bottom of the image gives a good idea of how easily I can differentiate the scale in the radar map. i.e. badly.

I threw together a few lines of Python that will change the palette of the images to something that is useful for colourblind people:


# This requires the Python Imaging Library. If you're running Ubuntu or Debian
# apt-get install python-imaging
import Image

existing_palette = [ (245,245,255), (180,180,255), (120,120,255), (20,20,255),
(0,216,195), (0,150,144), (0,102,102), (255,255,0),
(255,200,0), (255,150,0), (255,100,0), (255,0,0),
(200,0,0), (120,0,0), (40,0,0) ]
new_palette = [ (255-v*32,255-v*32,255) for v in xrange(7) ] + [ (v,v,255-v*32) for v in xrange(8) ]
palette_map = dict(zip(existing_palette, new_palette))

def map_pal(pal):
"""change the palette. PIL uses concatinated RGB triplets as a palette format
"""
inp = list(pal)
out = []
while len(inp) > 0:
p = tuple(inp[:3])
out.extend(palette_map.get(p,p))
inp = inp[3:]
return out

if __name__ == "__main__":
import sys

img = Image.open(sys.argv[1])
pal = img.getpalette()
pal = map_pal(pal)
img.putpalette(pal)
img.save(sys.argv[2])

Here is the image above converted. (I'm not dealing with the GIF transparency properly).

Incidentally, the storm going over Sydney at the moment is INSANE.
Previous post Next post
Up