Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Grabbing QQuickItem to image and comparing to QImage from disk fails because of inconsistent alpha channel premultiplication
Qt 6.11 is out! See what's new in the release blog

Grabbing QQuickItem to image and comparing to QImage from disk fails because of inconsistent alpha channel premultiplication

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 186 Views 2 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
    Andreas Schacherbauer
    wrote on last edited by
    #1

    Hi,
    I want to verify the implementation of a custom QQuickItem that derives from QQuickPaintedItem. The plan is to grab it at test runtime to an image and compare it against a reference image (which was stored from the initial test run, so it was also generated by the Qt engine).
    The format from the software image is QImage::Format_ARGB32_Premultiplied, so I call reinterpretAsFormat(QImage::Format_ARGB32_Premultiplied) on the reference image I load from disk to assure that both have the same format.
    It appears as if the software image has the premultiplication applied different then the reference image. Is this expected or an issue in QImage?

    My workaround for now is to store the grabbed image to disk and load it immediately after again. Then the comparison is successfull.

    Another note: different color values are reported from QImage::pixel(x, y) and QImage::pixelColor(x,y) depending on the image format of the two images.

    Thx,
    Andi

    1 Reply Last reply
    1

    • Login

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