发布于 2017-08-17 00:23:27
交换颜色的另一种方法是使用-color-matrix选项。例如,要将RGB转换为BGR:
convert input.png -color-matrix '0 0 1
0 1 0
1 0 0' output.png发布于 2017-08-17 00:38:11
在Imagemagick6中,您可以使用-swap命令轻松完成此操作。让我们交换徽标图像中的红色和蓝色通道。

convert logo.png -separate +channel \
-swap 0,2 -combine -colorspace sRGB logo_bgr.png

对于非常旧的Imagemagick版本,使用RGB而不是sRGB。
在Imagemagick 7中,使用magick而不是convert。
发布于 2011-08-19 15:48:14
我有一个想法,如何在RGB图像中交换红色和蓝色:
convert ( image_RGB.bmp -channel B -separate ) \
( image_RGB.bmp -channel G -separate ) \
( image_RGB.bmp -channel R -separate ) -channel RGB -combine image_BGR.bmp你只需从原始图像中剪切通道,并以相反的顺序写入它们。
https://stackoverflow.com/questions/7025788
复制相似问题