Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Brings up the image nicely on the label
QtWS25 Last Chance

Brings up the image nicely on the label

Scheduled Pinned Locked Moved Solved General and Desktop
pyqt6image displaypython
3 Posts 2 Posters 400 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AlbertRicky
    wrote on 27 Feb 2023, 12:08 last edited by
    #1

    Images in label.jpg

    How do I change the input image to better like the one on the right?
    Thank you

    P 1 Reply Last reply 27 Feb 2023, 16:03
    0
    • A AlbertRicky
      27 Feb 2023, 12:08

      Images in label.jpg

      How do I change the input image to better like the one on the right?
      Thank you

      P Offline
      P Offline
      Pl45m4
      wrote on 27 Feb 2023, 16:03 last edited by
      #2

      @AlbertRicky

      Qt::KeepAspectRatio in QImage

      https://doc.qt.io/qt-6/qt.html#AspectRatioMode-enum


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      A 1 Reply Last reply 27 Feb 2023, 17:18
      3
      • P Pl45m4
        27 Feb 2023, 16:03

        @AlbertRicky

        Qt::KeepAspectRatio in QImage

        https://doc.qt.io/qt-6/qt.html#AspectRatioMode-enum

        A Offline
        A Offline
        AlbertRicky
        wrote on 27 Feb 2023, 17:18 last edited by
        #3

        @Pl45m4 Thank you.
        Documentation for Python : https://doc.qt.io/qtforpython-5/PySide2/QtGui/QPixmap.html

        Example of code :
        I give this because of the minimum examples on the internet

        from PyQt6.QtCore import Qt
        ...
        self.labelCropFace.setPixmap(pixmap3.scaled(self.labelCropFace.size(), Qt.AspectRatioMode.KeepAspectRatio))
        

        For other people who need it, hopefully it helps too

        1 Reply Last reply
        0
        • A AlbertRicky has marked this topic as solved on 27 Feb 2023, 17:19

        1/3

        27 Feb 2023, 12:08

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved