#!/usr/bin/python import sys from PIL import Image color_changes = [ [(0xA5, 0x92, 0xFF), (0xA0, 0x90, 0xFF)], [(0xF7, 0xF3, 0x5A), (0xF0, 0xF0, 0x58)], ] inputFile = sys.argv[1] outputFile = sys.argv[2] image = Image.open(inputFile) for y in range(image.size[1]): for x in range(image.size[0]): color = image.getpixel((x, y))[0:3] for color_pair in color_changes: if color_pair[0] == color: color = color_pair[1] image.putpixel((x, y), color) image.save(outputFile, image.format)