Qpixmap,qimage Image size Scaling Linux Edition

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.