Dynamic Image scaling/rotation

  • This may be a simple question with a simple answer, so here's hoping... I have an image and I need to compensate for its orientation. To me this means I have to transform the content, not simply set a rotation for it to be drawn, because the actual image bits need to eventually be passed on to OpenGL for generation as a texture.

    So the question... within QML (be it inline script or a function... but not C++), does anyone have a suggestion how I might execute an transform based on an arbitrary rotation? I don't know what the rotation is at the time of the UI's creation, it has to happen afterwards. (In an onClicked: block for example)

  • Lifetime Qt Champion


    Do you mean something like "Rotation":http://doc.qt.io/qt-5/qml-qtquick-rotation.html#details ?

  • Sure, that is the concept. However, it is my understanding that rotation is simply a value that tells the QML engine how to draw that image, it doesn't actually transform the content of the image. (By transform I mean "manipulate the bits in the image", not just turn the rectangle on its side.)

    For instance, if I have a portrait image and set rotation to 90, it would be drawn on its side. If I copy that image to another, the second image would still be in portrait, not a new version of the content on its side.

    Is my understanding of the rotation value correct or am I missing something?

  • Lifetime Qt Champion

    Indeed, you understood it correctly. I'm not sure that the manipulation you would like to do are available in QML

  • Just to close the topic out, at this point in time it seems the only solution is to pass the content from QML to C++ and perform the rotation there.

    The reason for asking in the first place is that the QML camera does not always operate as expected. In this instance on an iPhone 6 it was taking pictures that were offset by 90 degrees from the orientation of the viewfinder. Android phones and tablets performed correctly as did iPads.

  • Lifetime Qt Champion

    Then it's a bug, does your iPad and iPhone share the same iOS version ?

    In any case, you should take a look at the "bug report system":http://bugreports.qt.io to see if it's something known

  • I think there are a few bugs tied to the camera in iOS.


    Even after trying the 5.4.1 snapshot, my issues still persist. Besides re-submitting a bug report, do you know of a way to contact anyone involved in the testing/debugging/release process?

  • Lifetime Qt Champion

    You can ask on the "interest mailing list":http://lists.qt-project.org/mailman/listinfo/interest (don't forget to subscribe first) or the #qt IRC channel. If you have one of the commercial license you can also contact the Qt Company through the Support Center

Log in to reply

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