문제

This is what I have so far:

QFile file(fileName);  
file.open(QIODevice::WriteOnly);  
QPixmap pixmap = QPixmap.loadFromData((const uchar *) imageBuffer_pointer, (sizeof(imageRows) * sizeof(imageCols));  
pixmap.save(&file, "JPG");  
pixmap.save(&file, "PNG");  

But it only produces 0 byte image files

도움이 되었습니까?

해결책

It is much easier to just give the save() function a file name as a first parameter:

QPixmap pixmap = QPixmap.loadFromData((const uchar *) imageBuffer_pointer, 
    (sizeof(imageRows) * sizeof(imageCols));
pixmap.save(fileName, "JPG");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top