问题
So, I'm using Wand Python Library to mess around with some images.
I just want it to look at an image, pixel by pixel, and for each pixel that is a specific color, say '4d4d4d', replace that pixels color to something else, like '#00ff00'. That's it. I've thoroughly scoured the documentation and I can't for the life of me figure out how to do this.
回答1:
If anyone is interested the python code would be something like this:
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
with Drawing() as draw:
draw.fill_color = Color('#00ff00')
draw.color(x,y,'replace')
with Image(filename='image.jpg') as img:
draw(img)
img.save(filename='new_image.jpg')
来源:https://stackoverflow.com/questions/33915785/change-color-of-specific-pixels-wand