hi,
I have a QImage which is a color image with depth of 32bpp and want to convert it to a grayscale picture. I will explain in detail.
I have a coulr bmp picture , a red circle in a white background. with 16 million pixels. this picture is loaded and saved as a Qimage. after loading I checked the depth and found it as 32. now I use the function
"m_imageSrc= m_imageSrc.convertToFormat(QImage::Format_Indexed8,ColorTab,Qt::ThresholdDi
ther );"
(the reason why i used Threshold dither is becasue withthis i was getting the picture without any noise, while with other option i was getting some noise in my picture)
and the resulting m_imagesrc (also a QImage) is a bmp picture with depth of 8bpp, but the strange thing is that the colour of the circle is still red (which should not be the case in a grayscale image.).. can you suggest anything for this.
further I used the fuction of
"m_imageSrc.setColorTable(ColorTab);" // with color tab declared upto 256
now the red circle transforms to dark gray , but the problem is that even the white background is changed to light gray.
after doing all this I now convert my QImage to Qpixel for displaying on the label.
my requirement was to have the QImage converted to the 8bpp and also change from redcolour to greyscale, just like it does in any of the photoshop software.
hope you understand my mail coz have written is haphazardly, thanx in advance.
reagrds.