Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Image: Error decoding: Unable to read image data
Forum Updated to NodeBB v4.3 + New Features

QML Image: Error decoding: Unable to read image data

Scheduled Pinned Locked Moved Solved QML and Qt Quick
18 Posts 5 Posters 11.7k Views 3 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.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi
    Sounds almost impossible.

    also same file ?
    It seems like it dont like file.¨

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Anas_Deshmukh
      wrote on last edited by
      #3

      hi @mrjj aahhhh... yes same cpp function i am calling.. same code line in both .qml files.. now i need to figure out why it dont like file :)..

      mrjjM 1 Reply Last reply
      0
      • A Anas_Deshmukh

        hi @mrjj aahhhh... yes same cpp function i am calling.. same code line in both .qml files.. now i need to figure out why it dont like file :)..

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #4

        @Anas_Deshmukh

        Well first start is to click on image and see if it can be open at all.
        maybe its just raw or incomplete. :)

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Anas_Deshmukh
          wrote on last edited by
          #5

          @mrjj its perfectly fine data, i can see it well by clicking directly.
          i am wondering same code working fine week ago, i havent touch the code block meantime and got this error. other qml file work well issue with this one only.

          mrjjM 1 Reply Last reply
          0
          • A Anas_Deshmukh

            @mrjj its perfectly fine data, i can see it well by clicking directly.
            i am wondering same code working fine week ago, i havent touch the code block meantime and got this error. other qml file work well issue with this one only.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @Anas_Deshmukh
            Its Monday syndrome on a Friday.
            If you try other image at other location.
            Still same error?

            A 1 Reply Last reply
            3
            • T Offline
              T Offline
              Tirupathi Korla
              wrote on last edited by Tirupathi Korla
              #7

              @Anas_Deshmukh
              It may not be a jpg file but has extension as jpg. Please try with another file.

              A 1 Reply Last reply
              0
              • T Tirupathi Korla

                @Anas_Deshmukh
                It may not be a jpg file but has extension as jpg. Please try with another file.

                A Offline
                A Offline
                Anas_Deshmukh
                wrote on last edited by
                #8

                @Tirupathi-Korla image genrated after cpp function call, if image had wrong data then it must affect other .qml files.

                raven-worxR T 2 Replies Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #9

                  Please provide a download link for the jpg file.

                  A 1 Reply Last reply
                  2
                  • A Anas_Deshmukh

                    @Tirupathi-Korla image genrated after cpp function call, if image had wrong data then it must affect other .qml files.

                    raven-worxR Offline
                    raven-worxR Offline
                    raven-worx
                    Moderators
                    wrote on last edited by
                    #10

                    @Anas_Deshmukh
                    show the cpp method implementation please.
                    Also how is this method called exactly (regarding thread safety)?

                    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                    If you have a question please use the forum so others can benefit from the solution in the future

                    1 Reply Last reply
                    1
                    • A Anas_Deshmukh

                      @Tirupathi-Korla image genrated after cpp function call, if image had wrong data then it must affect other .qml files.

                      T Offline
                      T Offline
                      Tirupathi Korla
                      wrote on last edited by
                      #11

                      @Anas_Deshmukh
                      Try figuring out the image format you are using. Try using any png file..

                      A 1 Reply Last reply
                      0
                      • T Tirupathi Korla

                        @Anas_Deshmukh
                        Try figuring out the image format you are using. Try using any png file..

                        A Offline
                        A Offline
                        Anas_Deshmukh
                        wrote on last edited by
                        #12

                        @Tirupathi-Korla

                        int ipCamera::capturePreviewImage1() {
                        
                            int ret;
                        
                            fileClass fileClass1;
                            bool flag=fileClass1.fileExists("/home/user/ipcamera/previewImage/camera1.jpg");
                            if(flag)
                                QFile::remove("/home/user/ipcamera/previewImage/camera1.jpg");
                        
                            QString cameraIp="192.168.1.113";
                        
                            QString command="wget -O /home/user/ipcamera/previewImage/camera1.jpg http://"+ cameraIp+"/snapshot.jpg?user=admin&pwd=";
                        
                            ret=system(qPrintable(command));
                             if(ret<0) {
                                qDebug() << "system call for capturePreviewImage1 failed";
                                return ret;
                            }
                         
                            QString permission="chmod -R 777 /home/user/ipcamera/previewImage/";
                            qDebug() << "change permission command : previewImage : " << permission;
                        
                            qDebug() << "previewImage1  end ";
                            return 1;
                        }```
                        T 1 Reply Last reply
                        0
                        • ? A Former User

                          Please provide a download link for the jpg file.

                          A Offline
                          A Offline
                          Anas_Deshmukh
                          wrote on last edited by
                          #13

                          @Wieland its ip camera . command i am using is :

                          wget -O /home/user/ipcamera/previewImage/camera1.jpg http://192.168.1.113/snapshot.jpg?user=admin&pwd=
                          
                          1 Reply Last reply
                          0
                          • A Anas_Deshmukh

                            @Tirupathi-Korla

                            int ipCamera::capturePreviewImage1() {
                            
                                int ret;
                            
                                fileClass fileClass1;
                                bool flag=fileClass1.fileExists("/home/user/ipcamera/previewImage/camera1.jpg");
                                if(flag)
                                    QFile::remove("/home/user/ipcamera/previewImage/camera1.jpg");
                            
                                QString cameraIp="192.168.1.113";
                            
                                QString command="wget -O /home/user/ipcamera/previewImage/camera1.jpg http://"+ cameraIp+"/snapshot.jpg?user=admin&pwd=";
                            
                                ret=system(qPrintable(command));
                                 if(ret<0) {
                                    qDebug() << "system call for capturePreviewImage1 failed";
                                    return ret;
                                }
                             
                                QString permission="chmod -R 777 /home/user/ipcamera/previewImage/";
                                qDebug() << "change permission command : previewImage : " << permission;
                            
                                qDebug() << "previewImage1  end ";
                                return 1;
                            }```
                            T Offline
                            T Offline
                            Tirupathi Korla
                            wrote on last edited by Tirupathi Korla
                            #14

                            @Anas_Deshmukh
                            File format in the header of image file might be different.
                            Open file with binary editor in Qt Creator. You should see actual file format of the image. Change format of your image to that format and you should not see any error.

                            Usually jpeg file starts with 0xFF 0xD8 and ends with 0xFF 0xD9, which in your case showing as starting of your file.

                            And one more thing.. If image has wrong data, it wont effect other .qml file.

                            A 2 Replies Last reply
                            0
                            • T Tirupathi Korla

                              @Anas_Deshmukh
                              File format in the header of image file might be different.
                              Open file with binary editor in Qt Creator. You should see actual file format of the image. Change format of your image to that format and you should not see any error.

                              Usually jpeg file starts with 0xFF 0xD8 and ends with 0xFF 0xD9, which in your case showing as starting of your file.

                              And one more thing.. If image has wrong data, it wont effect other .qml file.

                              A Offline
                              A Offline
                              Anas_Deshmukh
                              wrote on last edited by
                              #15

                              @Tirupathi-Korla thanks for note abt qt binary editor its good to learn, but in every scenario my file starts with 0xFF 0xD8 and ends with 0xFF 0xD9 (default jpeg).
                              If i open same file in other qml it open correctly, it seems with that perticular .qml file lead me err.
                              still trying to fix it...

                              1 Reply Last reply
                              0
                              • T Tirupathi Korla

                                @Anas_Deshmukh
                                File format in the header of image file might be different.
                                Open file with binary editor in Qt Creator. You should see actual file format of the image. Change format of your image to that format and you should not see any error.

                                Usually jpeg file starts with 0xFF 0xD8 and ends with 0xFF 0xD9, which in your case showing as starting of your file.

                                And one more thing.. If image has wrong data, it wont effect other .qml file.

                                A Offline
                                A Offline
                                Anas_Deshmukh
                                wrote on last edited by Anas_Deshmukh
                                #16

                                @Tirupathi-Korla file command output, i am sure image capture is not corrupted, still wondering why it not open in qml with err

                                Not a JPEG file: starts with 0xff 0xd9
                                qrc:/source/entry_INO.qml:4202:17: QML Image: Error decoding: file:///home/user/ipcamera/previewImage/camera1.jpeg: Unable to read image data
                                
                                

                                file command ouput :

                                  file /home/user/ipcamera/previewImage/camera1.jpeg 
                                /home/user/ipcamera/previewImage/camera1.jpeg: JPEG image data, JFIF standard 1.01, baseline, precision 0, 4360x240
                                
                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  Anas_Deshmukh
                                  wrote on last edited by
                                  #17

                                  Hi everyone,

                                  I put tiny delay between capture event and loading event.
                                  in my code i figure out that i am loading before it get saved completely.

                                  nothing wrong with code, lesson learnt Never be so fast to access something before it finish first task.

                                  thanks everyone :)

                                  1 Reply Last reply
                                  1
                                  • mrjjM mrjj

                                    @Anas_Deshmukh
                                    Its Monday syndrome on a Friday.
                                    If you try other image at other location.
                                    Still same error?

                                    A Offline
                                    A Offline
                                    Anas_Deshmukh
                                    wrote on last edited by
                                    #18

                                    @mrjj monday syndrome cost me one sunday :(
                                    issue is fixed fix now.

                                    1 Reply Last reply
                                    1

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved