Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [Android / QML] unwanted image scaling when using Flickable element
Forum Updated to NodeBB v4.3 + New Features

[Android / QML] unwanted image scaling when using Flickable element

Scheduled Pinned Locked Moved Mobile and Embedded
androidqmlflickableimagescaling
3 Posts 2 Posters 1.7k 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.
  • B Offline
    B Offline
    bobtheboozer
    wrote on last edited by
    #1

    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

    p3c0P 1 Reply Last reply
    0
    • B bobtheboozer

      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

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi @bobtheboozer,
      Don't clip the Flickable as well as image. Or else it is going to to trim the image.
      Try doing the same way as shown in this example.

      157

      B 1 Reply Last reply
      0
      • p3c0P p3c0

        Hi @bobtheboozer,
        Don't clip the Flickable as well as image. Or else it is going to to trim the image.
        Try doing the same way as shown in this example.

        B Offline
        B Offline
        bobtheboozer
        wrote on last edited by
        #3

        @p3c0,

        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

        1 Reply Last reply
        0

        • Login

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