[Android / QML] unwanted image scaling when using Flickable element
-
Hi,
I noticed that if I use following code to show Image inside of Flickable, contents of the image gets scaled and/or filtered somehow depending on the size of the image.
Flickable { id: flickable1 clip: true width: parent.width height: parent.height contentX: flickable2.width contentY: flickable2.height contentWidth: image.width contentHeight: image.height boundsBehavior : Flickable.StopAtBounds flickDeceleration : 10000 property int start_x: 0 property int start_y: 0 pixelAligned: true Image { smooth: false id: image objectName : "image1" cache : false fillMode: Image.Pad clip:true source: "qrc:/test.png" }
If size of the image is large enough quality of the image drops. I can see that by comparing onscreen image to original file. I have not figured out exact image size which triggers this, but image with size of 1900x1363 pixels works fine but another image with size 3710x2023 gets manipulated somehow. Small details are lost
I tried to set properties like "clip", "fillMode", "smooth", "sourceSize" and "pixelAliged", but the problem persists.
My Qt version is 5.5.0. Same code on my laptop seems to work without problems. Memory requirements for bitmap size mentioned above should not be too much for device (Samsung Galaxy tab 2)
I would like to have original, unprocesssed image inside flickable element.
Any help would be appreciated,
Bob
-
Hi @bobtheboozer,
Don'tclip
theFlickable
as well asimage
. Or else it is going to to trim the image.
Try doing the same way as shown in this example. -
Thanks for advice. I removed clip, but unfortunately it did not help. Further testing shows that as long as image fits to 2048x2048 size there is no loss in image quality. After some searching, I am guessing that this might be caused by Android texture size limitation.
Dealing with Android's texture size limit
I don't know how Qt handles this internally, but it definitely looks like there is some automatic scaling happening when image is not fitting into certain size.
Maybe there is some workaround for this. Otherwise displaying large images requires more than "image + flickable" approach.
Bob