如何替换图像的颜色? [英] How to replace color of an image?
问题描述
我要替换图片的颜色。例如,将所有蓝色颜色变为红色,而不会对形状造成任何扭曲。当我尝试这样我可以交换颜色通过迭代每个像素,但是交换区域的形状变成一个扁平的形状。
I want to replace color of an image. For example turn all blue colors to red without any distortion on shape. When i try this i can swap the colors by iterating every pixel, however the shape of the swapped area turns into a flat shape.
example1 input: http://www.tutorialwiz.com/tutorials/changing_color/images/original.jpg < br>
example1输出: http://www.tutorialwiz.com/ tutorials / changing_color / images / 3.jpg
example1 input : http://www.tutorialwiz.com/tutorials/changing_color/images/original.jpg
example1 output: http://www.tutorialwiz.com/tutorials/changing_color/images/3.jpg
example2:一起输入输出: http://www.digital-photography-school.com/wp-content/uploads/2009/07/before -after.jpg
example2: input output together : http://www.digital-photography-school.com/wp-content/uploads/2009/07/before-after.jpg
推荐答案
通常的做法是使用 RGBImageFilter 。有关如何使用此类过滤器的信息,请参阅 FilteredImageSource 的文档。
The usual way to do this is to use an RGBImageFilter. See the docs for FilteredImageSource for how to use such a filter.
这篇关于如何替换图像的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!