Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    How can I read an image and resize it?

    General and Desktop
    2
    4
    1197
    Loading More Posts
    • 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
      hor_313 last edited by

      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 Reply Quote 0
      • raven-worx
        raven-worx Moderators last edited by

        @
        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 Reply Quote 0
        • H
          hor_313 last edited by

          [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 Reply Quote 0
          • raven-worx
            raven-worx Moderators last edited by

            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 Reply Quote 0
            • First post
              Last post