View Full Version : how to apply a color mask a QImage?
jackajack01
25th July 2012, 20:39
hello
I have a gray image in Qimage like this:
8043
and I need to apply a mask to change the color but without changing the image. For example...
8044
Any idea how I can do this????
thanks
wysota
25th July 2012, 21:49
How is the "mask" defined? Is it an image? How exactly do you want to "mask" the image?
jackajack01
26th July 2012, 17:11
I have an image in gray and I want you to see color.
How I can do that????
that is, change the pixels of the image grayscale to RGB
wysota
26th July 2012, 17:34
There is a number of algorithms you can use and depending which one you choose, you'll get a different result.
jackajack01
27th July 2012, 12:51
can you give me an example of one of these algorithms?
wysota
27th July 2012, 14:01
Launch Gimp or Photoshop and take a look at the different layer compositing modes.
jackajack01
27th July 2012, 15:57
I may not explain well, my English is terrible.
anyway I solved the problem by doing this:
QVector<QRgb>color; //vector must be completed
QImage img1("image.jpg");
QImage img2(img.width(), img.height(), QImage::Format_RGB32);
int n;
for(int x=0; x<img.width();x++)
{
for(int y=0; y<img.height();y++)
{
n=img1.pixel(x,y);
img2.setPixel( x, y, color[n] );
}
}
thanks
wysota
27th July 2012, 18:39
Doesn't it simply copy one image into the other?
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.