Qt Forum

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

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    QImage::scaled alters image format

    General and Desktop
    2
    4
    740
    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.
    • V
      Violet Giraffe last edited by

      When I'm doing

      @image.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)@

      on a grayscale image (depth() == 8) I'm getting an image with depth() == 32 which leads to serious memory layout issues for my algorithm. Is it a bug? It's not a documented effect. How can I resize a QImage without altering its format?

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Can you try without SmoothTransformation ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • V
          Violet Giraffe last edited by

          Hi,
          Yes, that works, thank you. Not an ideal solution at all, but better than nothing.

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            AFAIK, the smooth transformation does a format adaptation to create a good looking output and use optimized algorithm for that. Depending from where you image come from you can try doing the scaling before using QImage

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 0
            • First post
              Last post