QML Label dispays images with a blue-ish tint

yeah, resurfaced this because of tidings :slight_smile: it’s also mentioned in the original tjc report. It must be some hw adaptation wierdness.

1 Like

I did spot an image today that displayed correctly, I don’t remember seeing this before, the only difference to the state when I wrote this post is that I’m on 4.3 now (or perhaps I only noticed because you mentioned it and I started paying attention :slight_smile: ).
Strangely, video thumbnails don’t seem to be affected.

Duplicate of Label / Text - RichText styling / theming - #2 by Edz

To me the picture looks like it has mixed red and blue channels, i.e. as if BGR was used instead of RGB. I wonder if there is some uninitialized value somewhere that just happens to be right or wrong depending on what was in memory before.


I’m not sure about initialization but oddly enough, when looking a some content (netzpolitik.org/feed has full page items) … the first image renders bluish and the second image shows up normal. Very odd.

In the case of tidings, there is a complex scaling Item around the Label which makes it more difficult to debug https://github.com/poetaster/tidings/blob/ViewPageSlideShow/qml/pages/RescalingRichText.qml

With feeds from the guardian I just saw an Item/Article with the first two images in blue and the last image rendered normally.

I just checked this again. Also substituting Text { for Label {

ALL images turn blue and it’s not Label but the Silica Context which is to blame. For Tidings, I’m going to try to stop rendering ‘large’ amounts of HTML in Labels. I think that’s ‘wrong’ ™ anyway. But it’s interesting to note it’s not Label.

Yup, and I don’t know if it’s Silica to blame, because this isn’t reproducible in the emulator at all. My suspicion is that it’s in the hardware adaptation, but go figure.

I thought about this. But I don’t think it’s the case. Silica has a lot of colour palette stuff in it for doing the whole theme/ambience stuff. AND, it really is a bit ‘flake’ to pump html (like a < figure >< img > combo?) into a Text widget on steroids. Now, that latter complaint is directed at trolltech/qt.

In the practical case of Tidings HTML rendering, using Text or Label is just ‘the wrong solution’. But it’s ‘a solution’.

That would suggest it is as @tomin suggests, a color order issue.
And i tried with @Edz sample as input, this “fixes” the image:
convert 936e1ea54107edee8763dbc69650c6e7c9350904.jpeg -separate +channel -swap 0,2 -combine -colorspace sRGB out.png

Um. Ok, but this doesn’t address the colorspace (palette stuff) mangling in Label/Text does it? There are methods to apply colorspace mangling, though.

I mean, I get it, it’s not the best rendering in the world, but the amount of time it saved me to read simple text based news articles vs. opening it in the rubbish QT web browser that doesn’t work 90% of the time AND THEN having to open it in the Browser, accepting the cookies (again), tapping to close that annoying ad popup, and then scrolling to the place where I was reading because sites are poorly designed?
I know it’s a bit of a rant, but while rendering HTML in Label/Text is not the most elegant solution, it is an extremely fast one to synchronise the internet’s content with your brain :smiley:

I agree. That’s why I took over maintaining and developing Tidings. But the way the html that is rendered is handled is a hack. I also still don’t handle img src sets. That means that often the biggest (!!!) image from a set (the default is usually an unscaled image) get’s pulled. That really sucks. So, I had decided to rewrite the RescalingRichText component and replace it with a component that contains alternating html text and images in native qml. But I’m not done yet.

1 Like

I tested this with my one (for now non-released) app on the good old Nexus 4 wih SFOS and it renders this ok without blue-ish (in photo it’s on the right side, on the left is Redmi 5 Plus with SFOS

1 Like

Heh. So I implemented

// Swap color channels RGB → BGR
In paint and it is indeed just red an blue being swapped. At least in paint you can now swap em back :slight_smile:

1 Like

Just a note for reference that @attah had found a case where converions BGR->RGB are performed here. For further research.

Thanks for all the useful info digging deeper into this bug. I’ve created an internal bug report about it and tagged it as “tracked”.

Although I haven’t gone through all of qt base, yet, some not quite random stackoverflow:

Wherein the answer is:

The problem is in scaleImage(), because scaledToHeight() returns another image format. You may omit the scale operation, or convert the returned image to Format_RGBA8888: 

But finding where scaledToHeight() might be involved in a richtext rendering label (I’m doing scaling on in) I hadn’t found yet.

Thanks for Tracking!

1 Like

Initial testing demonstrates this

fixes this issue and also the color values of drawing images to Canvas.


Fix integrated to and sailed out already.


Thanks for your efforts!

1 Like