Reputation: 2663
I'm trying to create a monochrome QBitmap from a QImage. Pixels with an alpha greater than 0 should get turned on in the bitmap. It seems that this should be possible without explicitly looping through all the pixels.
I've gotten close by doing QBitmap.fromImage(QImage(imagePath).createAlphaMask()
. However, only the pixels with an alpha of 1 get turned on.
Upvotes: 1
Views: 1051
Reputation: 2663
Instead of a QImage
, I used a QPixmap
. This allowed me to call the function mask
, which provided me with the QBitMap
I desired:
QPixmap(imagePath).mask()
Upvotes: 2