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.4k 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.
  • A Offline
    A Offline
    Anas_Deshmukh
    wrote on 15 Dec 2017, 07:24 last edited by
    #1

    Hi all,

    I am using qt.4.8 with QtQuick 1.1.
    In my application i am having two diffrent .qml file(entry_INO.qml and exit_INO.qml), from each file i am calling cpp utility to capture image and display them., same code same functionality but

    but getting below error only from entry_INO.qml whereas everything works fine with exit_INO.qml

    entry_INO.qml :: loading preview image3
    Not a JPEG file: starts with 0xff 0xd9
    qrc:/source/entry_INO.qml:4186:17: QML Image: Error decoding: file:///home/user/ipcamera/previewImage/camera1.jpg: Unable to read image data
    
    
    
    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 15 Dec 2017, 07:30 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 15 Dec 2017, 07:35 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 :)..

        M 1 Reply Last reply 15 Dec 2017, 07:40
        0
        • A Anas_Deshmukh
          15 Dec 2017, 07:35

          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 :)..

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 15 Dec 2017, 07:40 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 15 Dec 2017, 07:43 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.

            M 1 Reply Last reply 15 Dec 2017, 07:51
            0
            • A Anas_Deshmukh
              15 Dec 2017, 07:43

              @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.

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 15 Dec 2017, 07:51 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 17 Dec 2017, 09:42
              3
              • T Offline
                T Offline
                Tirupathi Korla
                wrote on 15 Dec 2017, 08:17 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 15 Dec 2017, 13:12
                0
                • T Tirupathi Korla
                  15 Dec 2017, 08:17

                  @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 15 Dec 2017, 13:12 last edited by
                  #8

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

                  R T 2 Replies Last reply 15 Dec 2017, 13:24
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on 15 Dec 2017, 13:24 last edited by
                    #9

                    Please provide a download link for the jpg file.

                    A 1 Reply Last reply 16 Dec 2017, 13:58
                    2
                    • A Anas_Deshmukh
                      15 Dec 2017, 13:12

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

                      R Offline
                      R Offline
                      raven-worx
                      Moderators
                      wrote on 15 Dec 2017, 13:24 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
                        15 Dec 2017, 13:12

                        @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 15 Dec 2017, 18:45 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 16 Dec 2017, 13:45
                        0
                        • T Tirupathi Korla
                          15 Dec 2017, 18:45

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

                          A Offline
                          A Offline
                          Anas_Deshmukh
                          wrote on 16 Dec 2017, 13:45 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 16 Dec 2017, 17:53
                          0
                          • ? A Former User
                            15 Dec 2017, 13:24

                            Please provide a download link for the jpg file.

                            A Offline
                            A Offline
                            Anas_Deshmukh
                            wrote on 16 Dec 2017, 13:58 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
                              16 Dec 2017, 13:45

                              @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 16 Dec 2017, 17:53 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 17 Dec 2017, 07:33
                              0
                              • T Tirupathi Korla
                                16 Dec 2017, 17:53

                                @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 17 Dec 2017, 07:33 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
                                  16 Dec 2017, 17:53

                                  @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 17 Dec 2017, 07:50 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 17 Dec 2017, 09:40 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
                                    • M mrjj
                                      15 Dec 2017, 07:51

                                      @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 17 Dec 2017, 09:42 last edited by
                                      #18

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

                                      1 Reply Last reply
                                      1

                                      9/18

                                      15 Dec 2017, 13:24

                                      • Login

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