Important: Please read the Qt Code of Conduct -

QML->Image showing black rectangle instead of image

  • Hi everyone,

    i already asked this question in the QtPi forum, but i think it's too specific.

    My Problem:
    I use QML->Image to display an image on the raspberry pi.
    Whenever the image dimensions are too big (roughly >~2000pixel in one direction), i see a black rectangle instead of the image.
    When i limit the memory usage by "sourceSize" <~2000 it does work. But i need to work with the original image, not the downscaled one.

    My Code:
    @ Image{
    width: 800; height: 800
    sourceSize.width: 1920 -> works as long as the value is <~2000
    sourceSize.height: 1600
    x: 50; y: 50
    source: "pic1.jpg"
    opacity: 1
    fillMode: Image.PreserveAspectFit
    cache: false
    smooth: true

    I assigned 256MB memory to the gpu which is much more than the image i want to display (~3000x2000 pixel @24Bit -> ~17MB)


    Do you think it's a memory issue?

    Why are 256MB GPU Memory not enough?

    Any ideas how to debug this problem further?

    *My system: *
    desktop: qt 5.2.1
    raspberry: qt 5.3.0 (but i am not sure if it’s the final or some kind of beta. Is there a way to figure that out?)

    Thanks for all comments,

  • Qt Champions 2017

    Few inputs from my side. What is the size of the image ? If you don't specify any width and height does it work ? Can you try adding the scrollview for the image ?

  • bq. What is the size of the image?

    I have different, neither work:
    3264 x 2448
    3456 x 2592

    bq. If you don’t specify any width and height does it work ?

    You mean, without sourceSize.width and sourceSize.height?
    That doesn't work either

    bq. Can you try adding the scrollview for the image ?

    I didn't try that. What benefit would i have?


Log in to reply