View Full Version : how to resize video as lable with aspact ratio

18th September 2012, 16:46
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

any idea ..?

18th September 2012, 18:28
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.