from PIL import Image img = Image.open("D:\\pic2\\CZA3302.png")(w,h) = img.sizeim=img.convert("RGB") for i in xrange(w): for j in xrange(h): pos=(i,j) rgb = im.getpixel(pos) if rgb == (186, 197, 217): im.putpixel((i,j),(255,255,255)) if rgb == (180, 192, 213): im.putpixel((i,j),(255,255,255)) if rgb == (168, 183, 207): im.putpixel((i,j),(255,255,255)) if rgb == (230, 237, 241): im.putpixel((i,j),(255,255,255)) if rgb == (155, 182, 201): im.putpixel((i,j),(255,255,255)) if rgb == (216, 227, 235): im.putpixel((i,j),(255,255,255)) if rgb == (247, 247, 247): im.putpixel((i,j),(255,255,255)) if rgb == (239, 244, 247): im.putpixel((i,j),(255,255,255)) if rgb == (238, 241, 245): im.putpixel((i,j),(255,255,255)) if rgb == (248, 250, 252): im.putpixel((i,j),(255,255,255)) if rgb == (192, 193, 223): im.putpixel((i,j),(255,255,255)) if rgb == (174, 187, 210): im.putpixel((i,j),(255,255,255)) if rgb == (209, 216, 229): im.putpixel((i,j),(255,255,255)) if rgb == (190, 207, 221): im.putpixel((i,j),(255,255,255)) if rgb == (156, 183, 203): im.putpixel((i,j),(255,255,255)) if rgb == (212, 223, 232): im.putpixel((i,j),(255,255,255)) if rgb == (197, 207, 223): im.putpixel((i,j),(255,255,255)) if rgb == (222, 222, 239): im.putpixel((i,j),(255,255,255)) if rgb == (222, 231, 238): im.putpixel((i,j),(255,255,255)) if rgb == (196, 212, 223): im.putpixel((i,j),(255,255,255)) if rgb == (233, 240, 246): im.putpixel((i,j),(255,255,255)) im.save(‘D:\\Python27\\6.png‘)
时间: 2024-12-21 18:42:49