Disable transparency in QML Image



  • Is it possible to disable the transparency of an Image object in QML? Basically I'm loading an image and applying a heavy Gaussian blur on it. The problem occurs when the image has certain areas which are transparent. The blur takes these transparent pixels into account and it results in the blur becoming weaker.

    For example, this is the original image,

    0_1547248136384_f.png

    When I apply Gaussian blur (500 samples) I get this:

    0_1547248243501_a.png

    Notice that the image is still distinguishable (which it should not be at such a high blur)
    However, if I replace the transparent parts with black in the original image, like this:

    0_1547248353340_f2.png

    and then apply the same blur, I get the intended effect:

    0_1547248397101_b.png

    As such I would like to know if it is possible to disable transparency in the QML Image component (which would essentially be compositing the transparent image on a colored background, and loading the new image).



  • I sorted it out by placing the Image inside an Item along with a black rectangle behind it. Applying Gaussian blur on the Item solves the issue.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.