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

Brings up the image nicely on the label

Scheduled Pinned Locked Moved Solved General and Desktop
pyqt6image displaypython
3 Posts 2 Posters 860 Views 1 Watching
  • 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 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

    Pl45m4P 1 Reply Last reply
    0
    • A AlbertRicky

      Images in label.jpg

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

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on 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
      3
      • Pl45m4P Pl45m4

        @AlbertRicky

        Qt::KeepAspectRatio in QImage

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

        A Offline
        A Offline
        AlbertRicky
        wrote on 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

        • Login

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