REPRODUCIBILITY: 100%
OS VERSION: 3.4 - 4.4.0.64
HARDWARE: Vollaphone (GS290), Xperia 10ii
UI LANGUAGE: en
REGRESSION: not certain
DESCRIPTION:
When using a declarative Canvas item, using loadImage and drawImage will draw Portrait images rotated -90
This means that the QML Item cannot be used without creating a custom ImageProvider since Canvas provides no means to getting the orientation or setting it from Meta.
An example:
harbour-stopmotion app.
PRECONDITIONS:
STEPS TO REPRODUCE:
- Create a Canvas {} item
- Component.onCompleted: { loadImage(“url”) }
- ctx = drawingCanvas.getContext(‘2d’) ; ctx.drawImage( imageSource, 0, 0);
EXPECTED RESULT:
Default behavior should be to use the image meta data.
ACTUAL RESULT:
Portrait photo images rotated incorrectly.
MODIFICATIONS:
ADDITIONAL INFORMATION:
Currently mitigating by creating custom ImageProvider class:
QImageReader ir(filename);
ir.setAutoTransform(true);
It’s sufficient to use a image reader ans setAutoTransform to true. Works from 3.4 → 4.4
See also: