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. In QML how to set Image bytearray in Android?
Forum Updated to NodeBB v4.3 + New Features

In QML how to set Image bytearray in Android?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
15 Posts 4 Posters 1.5k 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.
  • M Offline
    M Offline
    Mikeeeeee
    wrote on last edited by
    #1

    Hi!
    In QML how to set Image bytearray in Android?
    In Windows normally I send the bytearray to the Image. In Android I get an error: W/lib Web View Browser.so(18315): qrc:/ListView1.qml:131:25: QML Image: Error decoding: data:image/jpg;base64,: Unsupported image format

    jsulmJ 1 Reply Last reply
    0
    • M Mikeeeeee

      Hi!
      In QML how to set Image bytearray in Android?
      In Windows normally I send the bytearray to the Image. In Android I get an error: W/lib Web View Browser.so(18315): qrc:/ListView1.qml:131:25: QML Image: Error decoding: data:image/jpg;base64,: Unsupported image format

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @mikeeeeee said in In QML how to set Image bytearray in Android?:

      Unsupported image format

      Either the data you're sending is not JPEG or you did not deploy the JPEG Qt plug-in together with you app.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mikeeeeee
        wrote on last edited by
        #3

        This works on Windows, so I think the format is fine.

        jsulmJ J.HilkJ 2 Replies Last reply
        0
        • M Mikeeeeee

          This works on Windows, so I think the format is fine.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @mikeeeeee said in In QML how to set Image bytearray in Android?:

          I think the format is fine

          No, it's not. Read the error you posted here:
          data:image/jpg;base64,: Unsupported image format

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • M Mikeeeeee

            This works on Windows, so I think the format is fine.

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @mikeeeeee
            might actually be an endian error, where do you get your Bytearray from?


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Mikeeeeee
              wrote on last edited by
              #6

              It's errors:
              W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqgif.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
              W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqicns.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
              W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqico.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
              W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqjpeg.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
              W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqtga.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
              W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqtiff.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
              W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqwbmp.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
              W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqwebp.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)

              How to fix this?

              jsulmJ 1 Reply Last reply
              0
              • M Offline
                M Offline
                Mikeeeeee
                wrote on last edited by
                #7

                I do in C++ screen, translate it into QImage and translate in Bytearray

                1 Reply Last reply
                0
                • M Mikeeeeee

                  It's errors:
                  W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqgif.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
                  W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqicns.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
                  W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqico.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
                  W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqjpeg.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
                  W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqtga.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
                  W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqtiff.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
                  W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqwbmp.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)
                  W linker : Warning: "/data/data/org.qtproject.example/qt-reserved-files/plugins/imageformats/libqwebp.so" has unsupported flags DT_FLAGS_1=0x80 (ignoring unsupported flags)

                  How to fix this?

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @mikeeeeee said in In QML how to set Image bytearray in Android?:

                  How to fix this?

                  Do you get this on Android?
                  For which platform were these libraries build?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    Mikeeeeee
                    wrote on last edited by
                    #9

                    Yes, I need an Android.

                    jsulmJ 1 Reply Last reply
                    0
                    • M Mikeeeeee

                      Yes, I need an Android.

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @mikeeeeee For which platform were these libraries build?

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        Mikeeeeee
                        wrote on last edited by Mikeeeeee
                        #11

                        For Android.
                        armeabi-v7a (Clang Qt 5.13.0 for Android ARMv7)

                        KroMignonK 1 Reply Last reply
                        0
                        • M Mikeeeeee

                          For Android.
                          armeabi-v7a (Clang Qt 5.13.0 for Android ARMv7)

                          KroMignonK Offline
                          KroMignonK Offline
                          KroMignon
                          wrote on last edited by KroMignon
                          #12

                          @mikeeeeee I do this on my Android application, and it works fine (Android 7.1/7.0 and Qt 5.7). Do you have enabled multimedia support in you PRO file with QT += multimedia ?

                          It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            Mikeeeeee
                            wrote on last edited by
                            #13

                            @kromignon said in In QML how to set Image bytearray in Android?:

                            multimedia

                            Yes.
                            If i do dhis, I get screenShot: "data:image/png;base64,"
                            The program does not take a screenshot.

                            QImage myScreen;
                            //QPixmap pic = QPixmap::grabWindow(QWidget::winId(),0,0,50,50);
                            //qDebug()<<QWidget::winId();
                            QScreen *screen = QGuiApplication::primaryScreen();
                            QPixmap pixamp;
                            pixamp = screen->grabWindow(0);
                            myScreen = pixamp.toImage();
                            //myScreen = quickView->grabWindow();
                            //myScreen.save("C:\\Users\\New Owner\\Downloads\\i.png");
                            QByteArray bArray;
                            QBuffer buffer(&bArray);
                            buffer.open(QIODevice::WriteOnly);
                            //myScreen.save(&buffer, "JPEG");
                            //QString image("data:image/jpg;base64,");
                            myScreen.save(&buffer, "PNG");
                            QString image("data:image/png;base64,");
                            image.append(QString::fromLatin1(bArray.toBase64().data()));
                            qDebug()<<"screenShot:"<<image;
                            return image;
                            
                            KroMignonK 1 Reply Last reply
                            0
                            • M Mikeeeeee

                              @kromignon said in In QML how to set Image bytearray in Android?:

                              multimedia

                              Yes.
                              If i do dhis, I get screenShot: "data:image/png;base64,"
                              The program does not take a screenshot.

                              QImage myScreen;
                              //QPixmap pic = QPixmap::grabWindow(QWidget::winId(),0,0,50,50);
                              //qDebug()<<QWidget::winId();
                              QScreen *screen = QGuiApplication::primaryScreen();
                              QPixmap pixamp;
                              pixamp = screen->grabWindow(0);
                              myScreen = pixamp.toImage();
                              //myScreen = quickView->grabWindow();
                              //myScreen.save("C:\\Users\\New Owner\\Downloads\\i.png");
                              QByteArray bArray;
                              QBuffer buffer(&bArray);
                              buffer.open(QIODevice::WriteOnly);
                              //myScreen.save(&buffer, "JPEG");
                              //QString image("data:image/jpg;base64,");
                              myScreen.save(&buffer, "PNG");
                              QString image("data:image/png;base64,");
                              image.append(QString::fromLatin1(bArray.toBase64().data()));
                              qDebug()<<"screenShot:"<<image;
                              return image;
                              
                              KroMignonK Offline
                              KroMignonK Offline
                              KroMignon
                              wrote on last edited by
                              #14

                              @mikeeeeee So your real problem is not showing PNG but taking a screenshot? right?

                              It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                Mikeeeeee
                                wrote on last edited by
                                #15

                                @kromignon said in In QML how to set Image bytearray in Android?:

                                o your real problem is not showing PNG but taking a screenshot? right?

                                Yes

                                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