QImage to QPixmap where should I add scale() If I want to set to QLable
-
@darrenleeleelee1
Hi
hmm, I cant guess why.
for me, it clearly ignores the AspectRatio.Maybe your picture is perfectly square?
wrote on 9 Jun 2021, 09:57 last edited by@mrjj no, It's
(2235, 3408)
-
@mrjj no, It's
(2235, 3408)
-
wrote on 9 Jun 2021, 13:41 last edited by
@mrjj
(512, 512)
-
@mrjj
(512, 512)
Hi
I tried with the same sizes as you, found image at (2235, 3408) alsoSo not why you always seems to see the same.
What Qt version are you using ?
-
Hi
I tried with the same sizes as you, found image at (2235, 3408) alsoSo not why you always seems to see the same.
What Qt version are you using ?
wrote on 10 Jun 2021, 06:04 last edited by darrenleeleelee1 6 Oct 2021, 06:06@mrjj
You use scale for QImage not QPixmap? -
@mrjj
You use scale for QImage not QPixmap?Hi
Yes.{ qimage = qimage.scaled(ui->label->width(),ui->label->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); auto pixmap = QPixmap::fromImage(qimage); ui->label->setPixmap(pixmap); }
-
Hi
Yes.{ qimage = qimage.scaled(ui->label->width(),ui->label->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); auto pixmap = QPixmap::fromImage(qimage); ui->label->setPixmap(pixmap); }
wrote on 10 Jun 2021, 06:26 last edited by@mrjj What is the different if I am scale to QPixmap
-
@mrjj What is the different if I am scale to QPixmap
Hi
as far as I know, nothing.
Both return a scaled copy.I cant see anything wrong with the code you shown. So unless its a bug in 5.9.7
i really have no idea why the images look the same to you.Also, you scale it down a lot so there should always be an effect.
-
Hi
as far as I know, nothing.
Both return a scaled copy.I cant see anything wrong with the code you shown. So unless its a bug in 5.9.7
i really have no idea why the images look the same to you.Also, you scale it down a lot so there should always be an effect.
wrote on 10 Jun 2021, 08:45 last edited by@mrjj OK, thanks, I found I was not put two Image together like you do.And I miss the change.Thanks you alot.Sorry bother you.
-
@mrjj OK, thanks, I found I was not put two Image together like you do.And I miss the change.Thanks you alot.Sorry bother you.
ahh. Well that explains why they look so much the same :)
No worries, its no bother at all.
18/18