Linux 下使用命令将图片反色

发布时间 2023-12-02 11:23:45作者: Leeds_Garden
# 单张图片反色
convert -negate image.png image_ne.png

# 单张图片反色(替换)
convert -negate image.png image.png

# 单张图片反色,修复格式不兼容
convert image.png image.png && convert -negate image.png image_ne.png
convert image.png image.png && convert -negate image.png image.png                                           # 单张图片反色,修复格式不兼容(替换)
find . -name "*.png" -type f -exec sh -c 'convert $0 $0 && convert $0 -negate ${0%.png}_ne.png' {} \;        # 当前目录下的png图片反色
find . -name "*.png" -type f -exec sh -c 'convert $0 $0 && convert -negate $0 $0' {} \;                      # 当前目录下的png图片反色(替换)