How can I convert pixel data in QImage to another format?
问题 I receive an instance of QImage with arbitrary QImage::Format . How can I create another instance of QImage with a particular QImage::Format of my choosing so that the actual image data is converted from the arbitrary format to my format? Example: QImage convertFormat(const QImage &inputImage, QImage::format outputFormat) { // What comes here? } //Usage QImage converted = convertFormat(mySourceImage, QImage::Format_Grayscale8); I am looking for a way to do this with existing code in Qt if