Get value of pixel from black and white image
helenebro last edited by
I have an image black and white and I want get pixel value (0 or 1 if it's white or black).
Which is the best image format ? How can I get only "black and white" component ?
sletta last edited by
@helenebro QImage::Format_Mono or QImage::Format_MonoLSB will both do the job. You can then read/write 0/1 with QImage::pixel() / QImage::setPixel(). For faster access to the pixel data, if that is needed, you should use the direct accessors with scanline() / constScanline() or bits() / constBits(), but then you need to take care of the bit offsets for each 32-byte block of pixel values.