def convert_colour(region_number, incolour, outcolour):
#print(region_list.regions_d[region_number][0].split('\\')[7], incolour, outcolour)
img = Image.open(region_list.regions_d[region_number][0])
img = img.convert("RGBA")
newData = []
newData = [outcolour if item==incolour else item for item in img.getdata()]
img.putdata(newData)
img.save(region_list.regions_d[region_number][0], "PNG")
colour_change_single(region_number, outcolour)
I have written the beginning of a map engine which runs off Pil and some javascript client side. Ignoring the rest of the code that is in the same file as this function, can any suggest an imporvement to this code here?