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. How can I read an image and resize it?
QtWS25 Last Chance

How can I read an image and resize it?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.4k 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.
  • H Offline
    H Offline
    hor_313
    wrote on last edited by
    #1

    Hi

    I am newbie in Qt . I am looking for a simle code for loading an image , at first . and then I am looking for a code to resize it to my intrest size .

    I am using OpenCV and I'll be so happy if someone helps me!

    Thanks

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @
      QPixmap pix = QPixmap("path-to-your-file").scaled(QSize(100,80));
      @

      Take a look at the docs for the "scaled":http://qt-project.org/doc/qt-4.8/qpixmap.html#scaled method's parameters.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hor_313
        wrote on last edited by
        #3

        [quote author="raven-worx" date="1367562015"]@
        QPixmap pix = QPixmap("path-to-your-file").scaled(QSize(100,80));
        @

        Take a look at the docs for the "scaled":http://qt-project.org/doc/qt-4.8/qpixmap.html#scaled method's parameters.[/quote]

        Thanks dear
        In vs we use picturebox in forms to show an image . And we can show the image with writing picturebox.image("image addresss"); in our code . How can I do it in Qt ?

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          i don't know picturebox controls .... but take a look at "QPixmap::loadFromData()":http://qt-project.org/doc/qt-4.8/qpixmap.html#loadFromData and it's overloads. I'm pretty sure you can get the data out from your existing Image.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0

          • Login

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