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. QImage on Android
Forum Updated to NodeBB v4.3 + New Features

QImage on Android

Scheduled Pinned Locked Moved Solved Mobile and Embedded
5 Posts 3 Posters 1.7k Views 1 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.
  • QojoteQ Offline
    QojoteQ Offline
    Qojote
    wrote on last edited by
    #1

    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");
    refImage.save(newFilePath, "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

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mvuori
      wrote on last edited by
      #2

      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 http://doc.qt.io/qt-5/qimage.html

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

      1 Reply Last reply
      0
      • QojoteQ Offline
        QojoteQ Offline
        Qojote
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • QojoteQ Offline
            QojoteQ Offline
            Qojote
            wrote on last edited by Qojote
            #5

            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.

            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