Dec*_*ook 5 python python-imaging-library
我正在尝试在 python 中使用 PIL 根据像素 RGB 值删除部分图像。从文档看来,功能点可以做我正在寻找的东西。但是,我很难遵循文档。如果我想将所有蓝色值小于 100 的像素更改为白色,那么最简单的方法是什么?
像下面这样的东西会起作用:
source = im.split()
mask = source[2].point(lambda i: i < 100 and 255)
im = Image.merge(im.mode, source)
Run Code Online (Sandbox Code Playgroud)
有关详细信息, 请参阅“点操作”标题下的PIL 教程。