Important: Please read the Qt Code of Conduct -

QImage on Android

  • Hi,

    I have noticed a strange behavior of QImage on android devices.
    When i am loading a reference picture and store it right back with another name:

    QImage refImage;
    refImage.load(refFilePath, "JPG");, "JPG");

    then the new image is much smaller and the detail informations disappered.
    How can i avoid this? Is this a bug or something?

    Best regards

  • It is normal with JPEG file everywhere. It is not the same file or same information. When you load the file you uncompress it and when you save it you compress it back with Qt's default compression, which clearly is different than the one it was originally compressed. You need to add the third parameter quality and for that find a value that matches your needs

    I'd use 95 and only adjust it down if the saving takes too much time or the files consume too much storage space.

  • Hi,
    Thanks for the advice. Quality setting does work.
    However, the pictures detail information are still not saved.

    After all, i managed it to copy them by hand into the JPG.

    Best regards

  • Lifetime Qt Champion


    If you only want to copy the the image, why not use QFile::copy for that ?

  • Copying the image was just to demonstrate that QImage does not include detail (EXIF) information.
    I am getting my images as a QByteArray which is a serialized jpg with EXIF information. Calling
    QImage.loadFromData() gives me a vaild jpg which can be stored with save() but without EXIF information.

    So i copied the EXIF information by hand.

Log in to reply