QImage::rgbSwapped()
返回一个QImage,其中所有像素的红色和蓝色组件的值被交换,有效地将RGB图像转换为BGR图像。

1 QImage image(fileName);
2 QImage bgr = image.rgbSwapped();