qpixmap

show matplotlib imshow output in Qt

让人想犯罪 __ 提交于 2020-05-15 19:26:49
问题 I have a 2D numpy array of type np.float64, and I want to show it as an image in a QLabel (or any other valid way): self.img = np.rot90(get_my_data()) # this line returns a 2D numpy array of type np.float64 self.qimg = QtGui.QImage(self.img, self.img.shape[0], self.img.shape[1], QtGui.QImage.Format_Grayscale8) self.myLabel.setPixmap(QtGui.QPixmap(self.qimg)) My code above returning the following error: TypeError: arguments did not match any overloaded call: QImage(): too many arguments QImage

Qt resize image with best quality

泄露秘密 提交于 2020-05-12 21:34:38
问题 Can anyone help me resize an image in qt without making the image pixelated. Here's my code. the result is not as good as the original quality..thanks... QImage img(name); QPixmap pixmap; pixmap = pixmap.fromImage(img.scaled(width,height,Qt::IgnoreAspectRatio,Qt::FastTransformation)); QFile file(folder+"/"+name); file.open(QIODevice::WriteOnly); pixmap.save(&file, "jpeg",100); file.close(); 回答1: You have to pass Qt::SmoothTransformation transformation mode to the scaled function like: QImage

Qt resize image with best quality

烈酒焚心 提交于 2020-05-12 21:34:04
问题 Can anyone help me resize an image in qt without making the image pixelated. Here's my code. the result is not as good as the original quality..thanks... QImage img(name); QPixmap pixmap; pixmap = pixmap.fromImage(img.scaled(width,height,Qt::IgnoreAspectRatio,Qt::FastTransformation)); QFile file(folder+"/"+name); file.open(QIODevice::WriteOnly); pixmap.save(&file, "jpeg",100); file.close(); 回答1: You have to pass Qt::SmoothTransformation transformation mode to the scaled function like: QImage

Qt resize image with best quality

左心房为你撑大大i 提交于 2020-05-12 21:29:51
问题 Can anyone help me resize an image in qt without making the image pixelated. Here's my code. the result is not as good as the original quality..thanks... QImage img(name); QPixmap pixmap; pixmap = pixmap.fromImage(img.scaled(width,height,Qt::IgnoreAspectRatio,Qt::FastTransformation)); QFile file(folder+"/"+name); file.open(QIODevice::WriteOnly); pixmap.save(&file, "jpeg",100); file.close(); 回答1: You have to pass Qt::SmoothTransformation transformation mode to the scaled function like: QImage

Create video file using sequence of QPixmap in QT Creator- C++

折月煮酒 提交于 2020-04-30 04:44:45
问题 I have QWidget (named as screenshotLabel) and continuously it's content is changing.I can get that lable content to qpixmap (named as originalPixmap) as bellow. originalPixmap = QPixmap(); QPixmap pixmap(screenshotLabel->size()); this->render(&pixmap); originalPixmap = pixmap; Now I want to save it as a video file.But I could not able to do it.How can I save QWidget content as a video file? 回答1: I found a way to generate video using OpenCV VideoWriter.I leave comments in the code that

PyQt5: QScrollArea Keep Pixmap Aspect Ratio

て烟熏妆下的殇ゞ 提交于 2020-02-06 11:22:27
问题 I've created a set of pixmap buttons (PicButton) using QAbstractButton based on this https://stackoverflow.com/a/2714554/6859682 and want to add them in a scroll area such that the user can scroll horizontally. However, I need Aspect ratio of the pixmap buttons to be constant The pixmap buttons should always occupy the full height of the window upto 200 px. The issue with my current code is that the pixmap buttons get squeezed when the height becomes too much. I was able to get the aspect

QImage/QPixmap size limitations?

此生再无相见时 提交于 2020-01-28 01:50:49
问题 Are there any known size/space limitation of QPixmap and/or QImage objects documented? I did not find any useful information regarding this. I'm currently using Qt 4.7.3 on OSX and Windows. Particulary I'm interested in: Width/Height limits? Limits depending on color format? Difference between 32/64 bit machines? Difference regarding OS? I would naively suspect that memory is the only limitation, so one could calculate max size by width x height x byte_per_pixel I assume that there is a more

Getting a HBITMAP from a QPixmap in QT5 (Windows)

给你一囗甜甜゛ 提交于 2020-01-13 07:56:48
问题 Now that QPixmap::toWinHBITMAP() has been deprecated, I can't find a way to get an HBITMAP from a QPixmap (or QImage). Googling, I found there's a function called qt_pixmapToWinHBITMAP() which seems would do what I need, but I can't find what module I should enable -if any- in my .pro file or what header I should include to use it, or perhaps something else. The reason I need a HBITMAP is to create a video using VFW. Of course, I'd love to be able to do that using only Qt. There's the

Getting Pixmap is a null pixmap on calling a function 500 times

≡放荡痞女 提交于 2020-01-06 19:31:43
问题 I am showing a image in qt label. Below is my code: void MyClass::onPushButtonClicked(QString myurl) { this->setCursor(Qt::WaitCursor); ui.qtImageLabel->clear(); qDebug()<<QTime::currentTime()<<"MyClass: onPushButtonClicked"; QNetworkAccessManager *qnam_push_button_clicked_show_image; QNetworkReply *reply; QNetworkRequest request; request.setHeader( QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded" ); QUrl url(myurl); request.setUrl(url); qnam_push_button_clicked_show

Getting Pixmap is a null pixmap on calling a function 500 times

泪湿孤枕 提交于 2020-01-06 19:31:04
问题 I am showing a image in qt label. Below is my code: void MyClass::onPushButtonClicked(QString myurl) { this->setCursor(Qt::WaitCursor); ui.qtImageLabel->clear(); qDebug()<<QTime::currentTime()<<"MyClass: onPushButtonClicked"; QNetworkAccessManager *qnam_push_button_clicked_show_image; QNetworkReply *reply; QNetworkRequest request; request.setHeader( QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded" ); QUrl url(myurl); request.setUrl(url); qnam_push_button_clicked_show