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. QImage::scaled alters image format

QImage::scaled alters image format

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 993 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.
  • V Offline
    V Offline
    Violet Giraffe
    wrote on last edited by
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0
      • V Offline
        V Offline
        Violet Giraffe
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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
          0

          • Login

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