How can i resize video with aspact ratio?
the problem is i have video with 640 x 480 and my lable size 400x400, which means the part of my video cut from right to left
i used :
QImage and
setPixmap(QPixmap::fromImage(qimgProcessed));
any idea ..?
How can i resize video with aspact ratio?
the problem is i have video with 640 x 480 and my lable size 400x400, which means the part of my video cut from right to left
i used :
QImage and
setPixmap(QPixmap::fromImage(qimgProcessed));
any idea ..?
When you have a QImage, your problem no longer has anything to do with video. It is just about resizing a QImage. Of course, you either get distortion or black borders (well, black or any colour you wish and program).
Now, as it happens, the default thing to happen when you scale a QImage is that the aspect ration is ignored...
QImage QImage::scaled ( const QSize & size, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode = Qt::FastTransformation ) const
If you want to keep the aspect ratio, change the obvious parameter to Qt::KeepAspectRatio.
See the details in QImage class reference.
Bookmarks