您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

如何使用PIL(Python-Imaging)反转图像的颜色?

如何使用PIL(Python-Imaging)反转图像的颜色?

请尝试以下文档中的内容http ://effbot.org/imagingbook/imageops.htm

from PIL import Image
import PIL.ImageOps

image = Image.open('your_image.png')

inverted_image = PIL.ImageOps.invert(image)

inverted_image.save('new_name.png')

注意:“ ImageOps模块包含许多“现成的”图像处理操作。该模块有些实验性,大多数操作员只能处理L和RGB图像。

python 2022/1/1 18:48:23 有345人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶