[Solved]
Changed from QLabel to QGraphicsView
QGraphicsColorizeEffect *effect;
effect = new QGraphicsColorizeEffect;
effect
->setColor
(QColor(Qt
::red));
QGraphicsColorizeEffect *effect;
effect = new QGraphicsColorizeEffect;
effect->setColor(QColor(Qt::red));
To copy to clipboard, switch view to plain text mode
Apologies for any inconvenience
Next time will do my homework better before posting
Apologies
Kind Regards
-----------------------------------------------------------------------------------------------------------------------------
This is a similar thread to others, but not the same!
I was initially trying to convert an image to gray scale
when my code instead of converting everything to grayscale
took a black & white image kept the black as is & converted the the white to dark blue----> fantastic
Thats actually what i needed, the thing is how do I change what colour should the white be converted to?
because technically my code does not specify blue!
image1
= image1.
convertToFormat(QImage::Format_RGB32);
QRgb color;
for (int i=0; f1<image1.width(); i++) {
for (int j=0; j<image1.height(); j++) {
color = image1.pixel(i, j);
image1.
setPixel(i, j,
QColor((qRed
(color
) + qGreen
(color
) + qBlue
(color
))/3).
rgb());
}
}
image1 = image1.convertToFormat(QImage::Format_RGB32);
QRgb color;
for (int i=0; f1<image1.width(); i++) {
for (int j=0; j<image1.height(); j++) {
color = image1.pixel(i, j);
image1.setPixel(i, j, QColor((qRed(color) + qGreen(color) + qBlue(color))/3).rgb());
}
}
To copy to clipboard, switch view to plain text mode
Whenever i put the above code i my program it converts all white to blue
Initially i wanted grayscale but im more than happy with this result
though I want to choose which color
Ideas please
Kind Regards
Bookmarks