Precautions:
1. The address where the image is loaded is sometimes not readable. You can explore the format of the current system.
2.scaled Zoom Mode Selection
3. Note the save path. The following program save path is in the current execution file directory.
Picopera::P icopera (Qobject *parent): Qobject (parent)
{
Qpixmap Pixmap;
Pixmap.load ("/home/arikes/programer/qt/imageopera/aa.jpg");
Qpixmap fitpixmap=pixmap.scaled (400,560, qt::keepaspectratiobyexpanding);
if (Fitpixmap.save ("Aaa2.png"))
Qdebug ("aaa2jpg success");
Else
Qdebug ("failed");
}
Picopera::P icopera (Qobject *parent): Qobject (parent)
{
Qimage Imgpic;
Imgpic.load ("/home/arikes/programer/qt/imageopera/aa.jpg");
Qimage fitimgpic=imgpic.scaled (400,560, qt::keepaspectratiobyexpanding);
if (Fitimgpic.save ("Bbb.png"))
Qdebug ("BBB success");
Else
Qdebug ("failed");
}
Both of the above can achieve the size change of the picture. But in fact they are different, see:
Http://blog.chinaunix.net/uid-25647278-id-3025412.html
Qpixmap,qimage Image size Scaling Linux Edition