Qt::black and Qt::green are values of enum Qt::GlobalColor. The value of Qt::black is 2 and Qt::green is 8. Comparing these values to the values of image pixels doesn't make sense to me...