PDA

View Full Version : converting image into monochrome format



aj2903
13th November 2009, 13:35
hii...
i'm able to create .bmp image.
But the image is not getting converted into Monochrome.

I have tried wth following code :



QPixmap bmp(100,50);
QPainter p(&bmp);
p.setRenderHint(QPainter::Antialiasing,blnVar);
p.setPen(Qt::white);
p.drawText(10,20,"AJ");
bmp.save("d:\\Test.bmp","bmp",-1);

imgTemp = bmp.toImage();

imgTemp.convertToFormat(QImage::Format_Mono,Qt::Mo noOnly);
imgTemp.save("d:\\tempMono.bmp","bmp",-1);



After executing this code, 2 bmp files are created but both are 32 bit.
How to convert it to monochrome format.
Can somebody help me to solve this ?

wysota
13th November 2009, 15:48
Look what QImage::convertToFormat() returns.

high_flyer
13th November 2009, 15:53
Try using a QBitmap