c++ - Can't save PNG image into file -
i have troubles image saving. have crop "1.png" rect , save file, empty 1 appearing (0 bytes). doing wrong?
void redactorform::cropbuttonslot(int x1, int y1, int x2, int y2) { qimage pixmap("1.png"); qrect rect(x1,y1,x2,y2); pixmap=pixmap.copy(rect); qstring filename("d:/yourfile.png"); qfile file(filename); file.open(qiodevice::writeonly); qdatastream out(&file); pixmap.save(filename,0,100); out <<pixmap; }
qimage's save method not take file name parameter, taske qfile. try this;
pixmap.save(&file, "png");
Comments
Post a Comment